@@ -22,7 +22,7 @@ from each other. These compartments ended up with the name “objects.”
22
22
23
23
(((encapsulation)))(((method)))(((interface)))An object is a hard
24
24
shell that encapsulates the gooey complexity inside of it, and instead
25
- offers us a few of knobs and connectors (think methods) that present
25
+ offers us a few knobs and connectors (think methods) that present
26
26
an _interface_ through which the object is to be used. The idea is
27
27
that the interface is relatively simple, and all the complex things
28
28
going on _inside_ of the object can be ignored when working with it.
@@ -108,7 +108,7 @@ value to `this`.
108
108
109
109
There is a method similar to `apply`, called `call`, which also calls
110
110
the function, but takes its arguments normally, rather than as an
111
- array. It is used to call a function with with a specific `this`
111
+ array. It is used to call a function with a specific `this`
112
112
value.
113
113
114
114
[source,javascript]
@@ -367,7 +367,7 @@ distinguishes between _enumerable_ and _non-enumerable_ properties.
367
367
368
368
All properties that we create by simply assigning to them are
369
369
enumerable. The standard properties in `Object.prototype` are all
370
- non-enumerable, which is why they do not show up such a `for`/`in`
370
+ non-enumerable, which is why they do not show up in such a `for`/`in`
371
371
loop.
372
372
373
373
(((defineProperty function)))It is possible to define our own
@@ -405,7 +405,7 @@ of information than what the `in` operator gives us.
405
405
406
406
When you are worried that someone (some other code you loaded into
407
407
your program) might have messed with the base object prototype, it is
408
- recommended to write you `for`/`in` loops like this:
408
+ recommended to write your `for`/`in` loops like this:
409
409
410
410
[source,javascript]
411
411
----
@@ -502,7 +502,7 @@ of these methods:
502
502
* `minWidth()` returns a number indicating its minimum width (in
503
503
characters).
504
504
505
- * `draw(width, height)` returns an array of string with length
505
+ * `draw(width, height)` returns an array of strings with length
506
506
`height`, each of them `width` characters wide. This represents the
507
507
content of the cell.
508
508
@@ -620,10 +620,10 @@ TextCell.prototype.draw = function(width, height) {
620
620
----
621
621
622
622
The `repeat` function helps build up strings that repeat a single
623
- character a given amount of times. The `draw` method uses it to add
623
+ character a given number of times. The `draw` method uses it to add
624
624
“padding” to lines, so that they all have the required length.
625
625
626
- And try it out by building up a checkerboard.
626
+ Let's try it out by building up a checkerboard.
627
627
628
628
[source,javascript]
629
629
----
@@ -944,7 +944,7 @@ space. It takes `x` and `y` parameters (numbers), which it saves to
944
944
properties by the same name.
945
945
946
946
Give the `Point` prototype two methods, `plus` and `minus`, which take
947
- another point as parameter, and return a new point that has the sum or
947
+ another point as a parameter, and return a new point that has the sum or
948
948
difference of the two points’ (the one in `this` and the parameter) x
949
949
and y coordinates.
950
950
@@ -1017,8 +1017,8 @@ object. The `minWidth` and `minHeight` methods call through to the
1017
1017
corresponding methods in the `inner` cell, but ensure that no number
1018
1018
less than the given size is returned (possibly using `Math.max`).
1019
1019
1020
- Don't forget to add a `draw` method that simply forwards the call the
1021
- inner cell.
1020
+ Don't forget to add a `draw` method that simply forwards the call to
1021
+ the inner cell.
1022
1022
1023
1023
!!solution!!
1024
1024
0 commit comments