I read about JavaScript prototypes here . The Object.create header contains code to illustrate the creation of objects with prototypes and some properties:
var person = {
kind: 'person'
}
var zack = Object.create(person);
console.log(zack.kind);
Then I came across this:
var zack = Object.create(person, {age: {value: 13} });
console.log(zack.age);
Instead of passing, {age: {value: 13} }I went through {age: 13}because it seemed simpler. Unfortunately, it was thrown out TypeError. To create properties of this object like this, why do we need to pass {age: {value: 13} }, not just {age: 13}?
source
share