I just tried it again, but it still isn’t working in Firefox.
Here’s the test I’ve been running (taken from MDN page):
var a = 5;
var b = 10;
if (a === 5) {
let a = 4; // The scope is inside the if-block
var b = 1;
console.log(a);
console.log(b);
}
console.log(a);
console.log(b);
But all I get in Firefox is SyntaxError: missing ; before statement
. If I change “let” to “var”, then the error goes away, which means “let” is the culprit.
EDIT: There’s a footnote on the MDN page that says:
Only available to code blocks in HTML wrapped in a <script type=“application/javascript;version=1.7”> block
When I used this, then Firefox successfully ran “let”. However, this type attribute also caused Chrome to not execute the code within that <script> block at all, which in my book makes this a no-go.