June 2018
Intermediate to advanced
348 pages
8h 19m
English
JavaScript objects are based on associative arrays, improved with the prototyping inclusion. The properties and values can be changed at runtime. Another common way to create objects is using the JavaScript Object Notation (JSON) or using functions.
Let's see how an object created by JavaScript code looks, and its JSON representation:
// Let's create the person objectfunction Person(first, last, age) { this.firstName = first; this.lastName = last; this.age = age;}var diego = new Person("Diego", "Arguelles", 27);//JSON representation of the same object{ firstName: "Diego", lastName: "Arguelles", age: 27}
Read now
Unlock full access