JavaScript Object Reference
JavaScript Objects
Objects are one of JavaScript's data types.
Objects are used to store key/value (name/value) collections.
A JavaScript object is a collection of named values.
The following example creates a JavaScript object with four key/value properties:
Example
const person = {
firstName: "John",
lastName: "Doe",
age: 50,
eyeColor: "blue"
};
Try it Yourself »
For a tutorial about objects, read our JavaScript Object Tutorial.
JavaScript Object Methods and Properties
Name | Description |
---|---|
constructor | Returns the function that created an object's prototype |
keys() | Returns an Array Iterator object with the keys of an object |
prototype | Let you to add properties and methods to JavaScript objects |
toString() | Converts an object to a string and returns the result |
valueOf() | Returns the primitive value of an object |