Skip to content

Commit d512818

Browse files
committed
minor fixes
1 parent eb23b2d commit d512818

File tree

2 files changed

+9
-3
lines changed
  • 1-js/02-first-steps/05-types
  • 9-regular-expressions/14-regexp-lookahead-lookbehind

2 files changed

+9
-3
lines changed

1-js/02-first-steps/05-types/article.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ Besides regular numbers, there are so-called "special numeric values" which also
4646
alert( "not a number" / 2 ); // NaN, such division is erroneous
4747
```
4848

49-
`NaN` is sticky. Any further operation on `NaN` returns `NaN`:
49+
`NaN` is sticky. Any further mathematical operation on `NaN` returns `NaN`:
5050

5151
```js run
52-
alert( "not a number" / 2 + 5 ); // NaN
52+
alert( NaN + 1 ); // NaN
53+
alert( 3 * NaN ); // NaN
54+
alert( "not a number" / 2 - 1 ); // NaN
5355
```
5456

55-
So, if there's a `NaN` somewhere in a mathematical expression, it propagates to the whole result.
57+
So, if there's a `NaN` somewhere in a mathematical expression, it propagates to the whole result (there's only one exception to that: `NaN ** 0` is `1`).
5658

5759
```smart header="Mathematical operations are safe"
5860
Doing maths is "safe" in JavaScript. We can do anything: divide by zero, treat non-numeric strings as numbers, etc.

9-regular-expressions/14-regexp-lookahead-lookbehind/article.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ alert( str.match(/\d+\b(?!€)/g) ); // 2 (the price is not matched)
5959

6060
## Lookbehind
6161

62+
```warn header="Lookbehind browser compatibility"
63+
Please Note: Lookbehind is not supported in non-V8 browsers, such as Safari, Internet Explorer.
64+
```
65+
6266
Lookahead allows to add a condition for "what follows".
6367

6468
Lookbehind is similar, but it looks behind. That is, it allows to match a pattern only if there's something before it.

0 commit comments

Comments
 (0)