0

I've read a lot of documentation on the let keyword in JavaScript, and I understand that the spec is still being revised and updated, but I've come across a usage of let which I have yet to see, and I was curious how this syntax works.

For context, it appears in nervgh/angular-file-upload, and this is the syntax usage I cannot understand:

let { forEach } = angular;

I see later in the code that forEach is used like so:

forEach(this.uploader._directives.over, this._removeOverClass, this);

It almost appears to be used as a namespace assignment.

yohohoho
  • 361
  • 2
  • 10
  • 3
    @pwee167 No, it is not a duplicate of that question. – Ram Aug 04 '15 at 20:47
  • 4
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment – Ram Aug 04 '15 at 20:48
  • 2
    As @Vohuman said, this is not a duplicate of http://stackoverflow.com/questions/762011/javascript-let-keyword-vs-var-keyword . The other duplicate is correct though. – Jan Aug 04 '15 at 21:00
  • I nominate this question for reopening to it can be closed with the correct duplicate. See: http://meta.stackoverflow.com/questions/300952/removing-wrong-duplicate-flag-when-there-is-a-correct-duplicate-flag – Jan Aug 09 '15 at 14:16
  • @Jan - I agree with your comment about the wrong duplicate. My misunderstanding was about the destructuring syntax, not the let keyword which just happened to be used in the example of destructuring I provided. The first duplicate didn't contain the information I sought in the first place, which led me to asking this question. – yohohoho Aug 09 '15 at 23:16

0 Answers0