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); assert.equal(pow(2, 3), 8);
}); });
it("3 raised to power 3 is 27", function() { it("3 raised to power 4 is 81", function() {
assert.equal(pow(3, 3), 27); assert.equal(pow(3, 4), 81);
}); });
}); });
@ -182,7 +182,7 @@ The result:
[iframe height=250 src="pow-2" edit border="1"] [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 ## 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: 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`. - 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: 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 ```js run
let animal = { 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 ## 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: It gives the following benefits:

View file

@ -125,7 +125,7 @@ If there are some actions upon leaving the parent element, e.g. an animation run
To avoid it, we can check `relatedTarget` in the handler and, if the mouse is still inside the element, then ignore such event. To avoid it, we can check `relatedTarget` in the handler and, if the mouse is still inside the element, then ignore such event.
Alternatively we can use other events: `mouseenter` и `mouseleave`, that we'll be covering now, as they don't have such problems. Alternatively we can use other events: `mouseenter` and `mouseleave`, that we'll be covering now, as they don't have such problems.
## Events mouseenter and mouseleave ## Events mouseenter and mouseleave

View file

@ -335,5 +335,5 @@ That's a way to run code in another, parallel thread.
Web Workers can exchange messages with the main process, but they have their own variables, and their own event loop. Web Workers can exchange messages with the main process, but they have their own variables, and their own event loop.
Web Workers do not have access to DOM, so they are useful, mainly, for calculations, to use multiplle CPU cores simultaneously. Web Workers do not have access to DOM, so they are useful, mainly, for calculations, to use multiple CPU cores simultaneously.
``` ```

View file

@ -34,7 +34,7 @@ Unlike strings, regular expressions have flag `pattern:u` that fixes such proble
## Unicode properties \p{...} ## Unicode properties \p{...}
```warn header="Not supported in Firefox and Edge" ```warn header="Not supported in Firefox and Edge"
Despite being a part of the standard since 2018, unicode proeprties are not supported in Firefox ([bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1361876)) and Edge ([bug](https://github.com/Microsoft/ChakraCore/issues/2969)). Despite being a part of the standard since 2018, unicode properties are not supported in Firefox ([bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1361876)) and Edge ([bug](https://github.com/Microsoft/ChakraCore/issues/2969)).
There's [XRegExp](http://xregexp.com) library that provides "extended" regular expressions with cross-browser support for unicode properties. There's [XRegExp](http://xregexp.com) library that provides "extended" regular expressions with cross-browser support for unicode properties.
``` ```