Skip to content

Commit

Permalink
Merge pull request denysdovhan#81 from NN---/patch-2
Browse files Browse the repository at this point in the history
var a,a,a;
  • Loading branch information
denysdovhan authored Mar 20, 2018
2 parents 40ce068 + 5250039 commit 6441ab0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ The source is available here: <https://github.com/denysdovhan/wtfjs>
- [Null and Relational Operators](#null-and-relational-operators)
- [`Number.toFixed()` display different numbers](#numbertofixed-display-different-numbers)
- [Comparing `null` to `0`](#comparing-null-to-0)
- [Same variable redeclaration](#same-variable-redeclaration)
- [Other resources](#other-resources)
- [🎓 License](#-license)

Expand Down Expand Up @@ -1439,6 +1440,30 @@ true
* [**7.2.12** Abstract Relational Comparison](https://www.ecma-international.org/ecma-262/#sec-abstract-relational-comparison)
* [**7.2.13** Abstract Equality Comparison](https://www.ecma-international.org/ecma-262/#sec-abstract-equality-comparison)

## Same variable redeclaration

JS allows to redeclare variables:

```js
a;
a;
// This is also valid
a, a;
```

Works also in strict mode:

```js
var a, a, a;
var a;
var a;
```
### 💡 Explanation:

All defenitions are merged into one definition.

* [**13.3.2** Variable Statement](https://www.ecma-international.org/ecma-262/#sec-variable-statement)

# Other resources

* [wtfjs.com](http://wtfjs.com/) — a collection of those very special irregularities, inconsistencies and just plain painfully unintuitive moments for the language of the web.
Expand Down

0 comments on commit 6441ab0

Please sign in to comment.