Object Initializers part2

Object Initialization
83
2/2









Using Object Initializers
Spaces and line breaks are not important. An object definition can span multiple lines.var John = {
name: "John",
age: 25
};
var James = {
name: "James",
age: 21
};
No matter how the object is created, the syntax for accessing the properties and methods does not change.
Don't forget about the second accessing syntax: John['age'].
Comments
Post a Comment