Skip to content

Commit d58f43f

Browse files
Fixes issues with some wtfs (#206)
Fixes: "Why you should use semicolons" - example "Double dot" - explanation
1 parent 0778f2a commit d58f43f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,10 +2007,10 @@ Let's try to coerce a number to a string:
20072007
27.toString() // > Uncaught SyntaxError: Invalid or unexpected token
20082008
```
20092009

2010-
Maybe we should try with a two dots?
2010+
Maybe we should try with two dots?
20112011

20122012
```js
2013-
(27).toString(); // -> '27'
2013+
27..toString(); // -> '27'
20142014
```
20152015

20162016
But why doesn't first example work?
@@ -2028,7 +2028,7 @@ You must always use parenthesis or an addition dot to make such expression valid
20282028
```js
20292029
(27).toString(); // -> '27'
20302030
// or
2031-
(27).toString(); // -> '27'
2031+
27..toString(); // -> '27'
20322032
```
20332033

20342034
- [Usage of toString in JavaScript](https://stackoverflow.com/questions/6853865/usage-of-tostring-in-javascript/6853910#6853910) on StackOverflow
@@ -2087,7 +2087,8 @@ Writing some standard JavaScript… and then BOOM!
20872087

20882088
```js
20892089
class SomeClass {
2090-
["array"] = ([]["string"] = "str");
2090+
["array"] = []
2091+
["string"] = "str"
20912092
}
20922093

20932094
new SomeClass().array; // -> 'str'
@@ -2109,7 +2110,7 @@ class SomeClass {
21092110

21102111
You basically assign a string `str` into an `array` property.
21112112

2112-
- [An original tween with an example](https://twitter.com/SeaRyanC/status/1148726605222535168) by Ryan Cavanaugh
2113+
- [An original tweet with an example](https://twitter.com/SeaRyanC/status/1148726605222535168) by Ryan Cavanaugh
21132114
- [TC39 meeting when they debated about it](https://github.com/tc39/notes/blob/master/meetings/2017-09/sept-26.md)
21142115

21152116
## Split a string by a space

0 commit comments

Comments
 (0)