Skip to content

Instantly share code, notes, and snippets.

@aaronfrost
Created September 10, 2014 08:36
Show Gist options
  • Select an option

  • Save aaronfrost/105e6873fb5bc6c08118 to your computer and use it in GitHub Desktop.

Select an option

Save aaronfrost/105e6873fb5bc6c08118 to your computer and use it in GitHub Desktop.
let expression weirdness in FF
//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;
}
//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;
}
@aaronfrost

Copy link
Copy Markdown
Author

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

@rwaldron

Copy link
Copy Markdown

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