@@ -60,8 +60,8 @@ That takes care of the cat and tree problems. But Jacques would prefer
6060to get rid of his condition entirely. The irregular occurrences of the
6161transformation make him suspect that they might be triggered by
6262something. For a while, he believed that it happened only on days when
63- he had been near oak trees. But avoiding oak trees did not cause the
64- problem to stop .
63+ he had been near oak trees. But avoiding oak trees did not stop the
64+ problem.
6565
6666{{index journal}}
6767
@@ -78,8 +78,8 @@ information.
7878{{index "data structure"}}
7979
8080To work with a chunk of digital data, we'll first have to find a way
81- to represent it in our machine's ((memory)). Say, as an example, that
82- we want to represent a ((collection)) of numbers: 2, 3, 5, 7, and 11.
81+ to represent it in our machine's ((memory)). Say, for example, that we
82+ want to represent a ((collection)) of the numbers 2, 3, 5, 7, and 11.
8383
8484{{index string}}
8585
@@ -116,9 +116,9 @@ _((index))_ given by the expression in the brackets.
116116{{index "zero-based counting"}}
117117
118118The first index of an array is zero, not one. So the first element is
119- read with ` listOfNumbers[0] ` . This convention takes some getting used
120- to. Zero-based counting has a long tradition in technology, and in
121- certain ways makes a lot of sense . Think of the index as the amount of
119+ retrieved with ` listOfNumbers[0] ` . Zero-based counting has a long
120+ tradition in technology, and in certain ways makes a lot of sense, but
121+ it takes some getting used to . Think of the index as the amount of
122122items to skip, counting from the start of the array.
123123
124124{{id properties}}
@@ -129,11 +129,11 @@ items to skip, counting from the start of the array.
129129
130130We've seen a few suspicious-looking expressions like ` myString.length `
131131(to get the length of a string) and ` Math.max ` (the maximum function)
132- in past examples . These are expressions that access a _ ((property))_
132+ in past chapters . These are expressions that access a _ ((property))_
133133of some value. In the first case, we access the ` length ` property of
134134the value in ` myString ` . In the second, we access the property named
135135` max ` in the ` Math ` object (which is a collection of
136- mathematics-related values and functions).
136+ mathematics-related constants and functions).
137137
138138{{index property, null, undefined}}
139139
@@ -143,13 +143,13 @@ these nonvalues, you get an error.
143143
144144``` {test: no}
145145null.length;
146- // → TypeError: Cannot read property 'length' of null
146+ // → TypeError: null has no properties
147147```
148148
149149{{indexsee "dot character", "period character"}}
150150{{index "[ ] (subscript)", "period character", "square brackets", "computed property"}}
151151
152- The two main ways to access properties in JavaScript are with a dot
152+ The two typical ways to access properties in JavaScript are with a dot
153153and with square brackets. Both ` value.x ` and ` value[x] ` access a
154154((property)) on ` value ` —but not necessarily the same property. The
155155difference is in how ` x ` is interpreted. When using a dot, the word
@@ -160,10 +160,10 @@ named "x", `value[x]` tries to evaluate the expression `x` and uses
160160the result as the property name.
161161
162162So if you know that the property you are interested in is called
163- "length ", you say ` value.length ` . If you want to extract the property
163+ "name ", you say ` value.name ` . If you want to extract the property
164164named by the value held in the binding ` i ` , you say ` value[i] ` .
165- Property names can be any string, and the dot notation only allows
166- names that look like valid binding names, so if you want to access a
165+ Property names can be any string, but the dot notation only works with
166+ names that look like valid binding names. So if you want to access a
167167property named "2" or "John Doe", you must use square brackets:
168168` value[2] ` or ` value["John Doe"] ` .
169169
@@ -177,9 +177,10 @@ anyway, you have to use the bracket notation to get at them.
177177The ` length ` property of an array tells us how many elements it has.
178178This property name is a valid binding name, and we know its name in
179179advance, so to find the length of an array, you typically write
180- ` array.length ` because it is easier to write than ` array["length"] ` .
180+ ` array.length ` because that's easier to write than ` array["length"] ` .
181181
182182{{id methods}}
183+
183184## Methods
184185
185186{{index [ function, "as property"] , method, string}}
@@ -209,7 +210,7 @@ value whose property we called. How this works is described in
209210[ Chapter ?] ( object#obj_methods ) .
210211
211212Properties that contain functions are generally called _ methods_ of
212- the value they belong to. As in, "_ toUpperCase _ is a method of a
213+ the value they belong to. As in, "` toUpperCase ` is a method of a
213214string".
214215
215216{{id array_methods}}
0 commit comments