This commit is contained in:
Ilya Kantor 2019-12-26 15:19:43 +03:00
commit bdcc7448d6
7 changed files with 9 additions and 9 deletions

View file

@ -159,8 +159,8 @@ We can select one of two ways to organize the test here:
assert.equal(pow(2, 3), 8);
});
it("3 raised to power 3 is 27", function() {
assert.equal(pow(3, 3), 27);
it("3 raised to power 4 is 81", function() {
assert.equal(pow(3, 4), 81);
});
});
@ -182,7 +182,7 @@ The result:
[iframe height=250 src="pow-2" edit border="1"]
As we could expect, the second test failed. Sure, our function always returns `8`, while the `assert` expects `27`.
As we could expect, the second test failed. Sure, our function always returns `8`, while the `assert` expects `81`.
## Improving the implementation

View file

@ -413,7 +413,7 @@ There are more functions and constants in `Math` object, including trigonometry,
To write numbers with many zeroes:
- Append `"e"` with the zeroes count to the number. Like: `123e6` is the same as `123` with 6 zeroes `123000000`.
- A negative number after `"e"` causes the number to be divided by 1 with given zeroes. E.g. `123e-6` means `0.000123` (`123` millionth).
- A negative number after `"e"` causes the number to be divided by 1 with given zeroes. E.g. `123e-6` means `0.000123` (`123` millionths).
For different numeral systems:

View file

@ -499,7 +499,7 @@ In the example below a non-method syntax is used for comparison. `[[HomeObject]]
```js run
let animal = {
eat: function() { // intentially writing like this instead of eat() {...
eat: function() { // intentionally writing like this instead of eat() {...
// ...
}
};

View file

@ -279,7 +279,7 @@ With private fields that's impossible: `this['#name']` doesn't work. That's a sy
## Summary
In terms of OOP, delimiting of the internal interface from the external one is called [encapsulation]("https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)").
In terms of OOP, delimiting of the internal interface from the external one is called [encapsulation](https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)).
It gives the following benefits: