Loading ...
Sorry, an error occurred while loading the content.

1407Re: array destructuring

Expand Messages
  • Douglas Crockford
    Aug 2, 2010
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, Mark Volkmann <r.mark.volkmann@...> wrote:
      >
      > Just learned something new! This works in Rhino 1.7. See the line with
      > the comment below.
      >
      > function assert(condition) {
      > if (!condition) print('assertion failed'));
      > }
      >
      > function getValues() {
      > return ['text', 19, true];
      > }
      >
      > var [s, n, b] = getValues(); // Array destructuring!
      >
      > assert(s === 'text');
      > assert(n === 19);
      > assert(b);
      >
      > I can't find this in the ECMAScript 3 spec. Is this a standard
      > JavaScript feature?

      No, which is why you should avoid it.
    • Show all 6 messages in this topic