Created
September 10, 2014 08:36
-
-
Save aaronfrost/105e6873fb5bc6c08118 to your computer and use it in GitHub Desktop.
let expression weirdness in FF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//I don't think that this is working right in Firefox | |
let c = let (a = getA()) a; | |
console.log(c, a); //Logs 1, 0 | |
//Why did it log 0 for "a"? | |
function getA(){ | |
return 1; | |
} | |
function getB(){ | |
return 2; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//I don't think that this is working right in Firefox | |
let c = let (a = getA(), b = getB()) a + b; | |
console.log(c, a, b); //Exception: b is not defined | |
//Why doesn't the first variable cause an exception. Only #of let variables > 1; | |
function getA(){ | |
return 1; | |
} | |
function getB(){ | |
return 2; | |
} |
Glad you shared this with me: there are no let
expressions or let
statements in ES6, only the declaration form.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the first file, Firefox is forgiving that I am referencing a non-existent variable. In the second file, it is tolerant of the first reference to a non-existing variable, but BARFS on the second reference to a non-existing variable. It should be forgiving on both. #icanhazinconsistency