Which of the following is a method to create an object in JavaScript?
- Object.create()
- new Object()
- createObject()
- initializeObject()
In JavaScript, you can create an object using the Object.create() method. This method allows you to specify the prototype object from which the new object should inherit properties and methods. The new Object() syntax is less commonly used for object creation.
Loading...
Related Quiz
- How can you add a method to an object in JavaScript?
- Considering browser compatibility, which array method would you avoid in Internet Explorer 8?
- What happens when a function declaration and a var variable are hoisted in the same scope?
- Which of the following is NOT a type of polymorphism supported by JavaScript?
- When defining a method in an object, the function associated with a property is referred to as a _________.