MDN Web Docs: JavaScript
https://developer.mozilla.org/en-US/docs/Web/JavaScript
JavaScript(JS) is a lightweight interpreted or JIT-compiled programming language with first-class functions. … JavaScript is a prototype-based, multi-paradigm, dynamic language, supporting object-oriented, imperative, and declarative(e.g. functional programming) styles.
As of 2012, all modern browsers fully support ECMAScript 5.1. On June 17, 2015, ECMA International published the sixth major version of ECMAScript which officially called ECMAScript 2015, and was initially refereed to as ECMAScript 6 or ES6.
Table of Content
- JavaScript Tutorial
- JavaScript first steps
- JavaScript building blocks
- Introducing JavaScript objects
- JavaScript Guide
- Client-side web APIs
- A re-introduction to JavaScript
- JavaScript data structures
- Equality comparison and sameness
- Inheritance and the prototype chain
- Strict mode
- JavaScript typed arrays
- Memory Management
- Concurrency model and Event loop
- JavaScript Reference
JavaScript Tutorial
JavaScript first steps
JavaScript building blocks
Introducing JavaScript objects
JavaScript Guide
Client-side web APIs
A re-introduction to JavaScript
JavaScript data structures
Equality comparison and sameness
Inheritance and the prototype chain
Strict mode
JavaScript typed arrays
Memory Management
Concurrency model and Event loop
JavaScript Reference
«««< HEAD
Standard build-in objects
=======
Standard Objects
master
Object
Inspecting Object
& Object.prototype
Constructor
{ [ nameValuePair1[, nameValuePair2[, ... nameValuePairN] ] ] }
: object literal- Shallow-cloning (excluding prototype) or merging objects is now possible using a shorter syntax with spread syntax than
Object.assign()
. But note thatObject.assign()
triggerssetters
whereas the spread operator doesn’t. - Shorthand property names (ES2015)
- Shorthand method names (ES2015)
- Prototype mutation
- See more at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer
- Shallow-cloning (excluding prototype) or merging objects is now possible using a shorter syntax with spread syntax than
new Object([value])
: create a wrapped object for the given value- Creating a user-defined object requires two steps:
- Define the object type by writing a function.
- Create an instance of the object with
new
.
- When the code
new Foo()
is executed, the following things happen:- A new object is created, inheriting from
Foo.prototype
- The constructor function
Foo
is called with the specified arguments, and withthis
bound to the newly created object. - The object returned by the constructor become the result of the whole
new
expression, or the object created in step 1 if no object is explicitly returned
- A new object is created, inheriting from
- See more at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new
- Creating a user-defined object requires two steps:
Properties
Object.length
Object.prototype
: not inheriting from this when created byObject.create(null)
Object.prototype.constructor
Object.prototype.__proto__
(not standardized)
Methods
Object.assign(target, ...sources)
- to copy all enumerable own properties from one or more source objects to a target object
- uses
[[Get]]
on the source and[[Set]]
on the target - can be used for: shallow clone, merging objects
Object.create(proto[, propertiesObject])
- create a new object, using an existing object to provide the newly object’s
_proto__
- create a new object, using an existing object to provide the newly object’s
Object.defineProperty(obj, props)
props
is an object whose own enumerable properties constitute descriptors to be defined or modifiedconfigurable
,enumerable
,value
,writable
,get
,set
Object.entries()
Object.freeze()
Object.getOwnPropertyDescriptor()
Object.getOwnPropertyDescriptors()
Object.getOwnPropertyNames()
Object.getOwnPropertySymbols()
Object.getPrototypeOf()
Object.is()
Object.isExtensible()
Object.isFrozen()
Object.isSealed()
Object.keys()
: only names of own enumerable propertiesObject.preventExtensions()
Object.seal()
Object.setPrototypeOf()
Object.values()
Object.prototype.hasOwnProperty()
Object.prototype.isPrototypeOf()
Object.prototype.propertyIsEmumerable()
Object.prototype.toLocaleString()
Object.prototype.toString()
Object.prototype.watch()
References
«««< HEAD
Array
=======
master
Expression and operators
Statements and declarations
Functions