mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-15 00:57:58 -05:00
Fix hoisting examples
Hoisting only happens to `var`. As kangax describes in [Why `typeof` is no longer “safe”](http://es-discourse.com/t/why-typeof-is-no-longer-safe/15/3). Also, I wonder if we need the whole section, since you recommend to [avoid using `var` altogether](https://github.com/airbnb/javascript/blob/b492/README.md#references).
This commit is contained in:
committed by
Josh Perez
parent
ee176044c3
commit
0cca5e21fc
@@ -1005,7 +1005,7 @@
|
||||
|
||||
anonymous(); // => TypeError anonymous is not a function
|
||||
|
||||
let anonymous = function() {
|
||||
var anonymous = function() {
|
||||
console.log('anonymous function expression');
|
||||
};
|
||||
}
|
||||
@@ -1021,7 +1021,7 @@
|
||||
|
||||
superPower(); // => ReferenceError superPower is not defined
|
||||
|
||||
let named = function superPower() {
|
||||
var named = function superPower() {
|
||||
console.log('Flying');
|
||||
};
|
||||
}
|
||||
@@ -1033,7 +1033,7 @@
|
||||
|
||||
named(); // => TypeError named is not a function
|
||||
|
||||
let named = function named() {
|
||||
var named = function named() {
|
||||
console.log('named');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user