Make nouns plural in keeping with 'world objects' (#19825)
* Make nouns plural in keeping with 'world objects' Sentence subject 'real world objects' is plural, so noun derivatives should be plural as well. * Grammar and readability edits.
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
---
|
||||
title: Build JavaScript Objects
|
||||
---
|
||||
Objects are useful for storing data in a structured way, and can be used to represent real world objects, like a cars or hotel to a computer.
|
||||
Objects are useful for storing data in a structured way, and can be used to represent real world objects, like cars, hotels or a computer.
|
||||
|
||||
Objects are similar to arrays, except that instead of using indexes to access and modify their data, you access the data in objects through what are called properties. There are two ways main to create objects: the Object Literal and the Constructor way.
|
||||
Objects are similar to arrays, except that instead of using indexes to access and modify their data, you access the data in objects through what are called properties. There are two main ways to create objects: the Object Literal and the Constructor.
|
||||
|
||||
Using the Object Literal way, here's how we would create sample object:
|
||||
Using the Object Literal, here's how we would create a sample object:
|
||||
|
||||
var cat = {
|
||||
name: "Whiskers",
|
||||
@ -14,7 +14,7 @@ Using the Object Literal way, here's how we would create sample object:
|
||||
enemies: ["Water", "Dogs"]
|
||||
};
|
||||
|
||||
Using the Constructor way, here's how we would create sample object:
|
||||
Using the Constructor, here's how we would create a sample object:
|
||||
|
||||
var cat = new Object();
|
||||
cat.name = "Whiskers";
|
||||
@ -22,5 +22,6 @@ Using the Constructor way, here's how we would create sample object:
|
||||
cat.tails = 1;
|
||||
cat.enemies = ["Water", "Dogs"];
|
||||
|
||||
In the Constructor way, we use the `new` keyword together with `Object` (with capital 'O') to create a new object instance. Afterward, we use dot notation to assign the property names and values of the object.
|
||||
An Object Constructor makes use of the `new` keyword together with `Object` ( capital 'O') to create a new object instance.
|
||||
We can then use dot notation to assign property names and values of the object.
|
||||
|
||||
|
Reference in New Issue
Block a user