Objects

suggest change

Syntax

Parameters

Property Description
value The value to assign to the property.
writable Whether the value of the property can be changed or not.
enumerable Whether the property will be enumerated in for in loops or not.
configurable Whether it will be possible to redefine the property descriptor or not.
get A function to be called that will return the value of the property.
set A function to be called when the property is assigned a value.

Objects are collections of key-value pairs, or properties. The keys can be Strings or Symbols, and values are either primitives (numbers, strings, symbols) or references to other objects.

In JavaScript, a significant amount of values are objects (e.g. functions, arrays) or primitives that behave as immutable objects (numbers, strings, booleans). Their properties or their prototype’s properties can be accessed using dot (obj.prop) or bracket (obj['prop']) notation. Notable exceptions are the special values undefined and null.

Objects are held by reference in JavaScript, not by value. This means that when copied or passed as arguments to functions, the “copy” and the original are references to the same object, and a change to one’s properties will change the same property of the other. This does not apply to primitives, which are immutable and passed by value.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Objects:
* Syntax

Table Of Contents
11 Arrays
12 Objects
14 Classes
16 Map
17 Set
24 Loops
27 Date
29 Scope
30 AJAX
35 Cookies
41 JSON
44 Fetch
45 Modules
46 Screen
64 Console
68 Symbols
73 Modals
76 Events
86 Proxy
89 WeakMap
90 WeakSet
102 Tilde