JavaScript Object Reference Manual

JavaScript Object

Objects are one of the data types in JavaScript.

Objects are used to store collections of key/value (name/value) pairs.

JavaScript objects are collections of named values.

The following example creates a JavaScript object with four key/value properties:

Instance

const person = {
  firstName: "Bill",
  lastName: "Gates",
  age: 19,
  eyeColor: "blue"
};

Try It Yourself

For tutorials on objects, please read our JavaScript Object Tutorial.

Methods and properties of JavaScript objects

Name Description
assign() Copies the property from the source object to the target object.
constructor Returns a function that creates the prototype of the created object.
create() Returns a new object created from an existing object.
defineProperties() Adds or changes a property.
defineProperty() Adds or changes a property.
entries() Returns an array of the object's key/value pairs.
freeze() Prevents any changes to the object.
fromEntries() Returns an object from the iterable list of key/value pairs.
getOwnPropertyDescriptor() Returns an array of object keys.
getOwnPropertyDescriptors() Returns an array of object keys.
getOwnPropertyNames() Returns an array of object keys.
groupBy() Groups the object elements based on the returned callback value.
isExtensible() returns true if the object is extensible.
isFrozen() returns true if the object is frozen.
isSealed() returns true.
keys() Returns an array of object keys.
preventExtensions() Prevents the addition of new properties to the object.
prototype Allows you to add properties and methods to JavaScript objects.
seal() Prevents the addition of new properties or the deletion of existing object properties.
toString() Converts the object to a string and returns the result.
valueOf() Returns the original value of the object.
values() Returns an array of object property values.