5

I bumped into a few statements from people that "let blocks and let expressions are obsolete" in SpiderMonkey, while there's very little information about it. I'm wondering what does this exactly mean? Isn't the "let" statement a popular new feature in ES6?

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Deprecated_and_obsolete_features

https://bugzilla.mozilla.org/show_bug.cgi?id=1023609

What's the difference between using "let" and "var" to declare a variable in JavaScript?

Xun Yang
  • 4,209
  • 8
  • 39
  • 68

2 Answers2

6

let variable declaration are still widely used. Something like:

let i = 4;

Is perfectly fine. The article you linked talks about let blocks. Something like

let (x = x + 1, y = x - 1) {
  console.log("This is a let block!");
}

Is obsolete and should not be used.

clickbait
  • 2,818
  • 1
  • 25
  • 61
chevybow
  • 9,959
  • 6
  • 24
  • 39
5

JS1.7 (from 2006) introduced features like destructuring and let, however they were different from let and destructuring that we know from ES6. The old implementation is obsolete, and no longer supported by Firefox' engine since v41.

You can read more about let blocks and let expressions in an old revision of MDN's page on the let keyword.

user
  • 23,260
  • 9
  • 113
  • 101
Bergi
  • 630,263
  • 148
  • 957
  • 1,375