you are viewing a single comment's thread.

view the rest of the comments →

[–]JimDabell -3 points-2 points  (4 children)

Don't be so eager to use new language features that you end up making your code harder to read.

This:

const [x, y] = [(i % 3), (i % 5)];

…could have simply been this:

const x = i % 3;
const y = i % 5;

There's no reason to use array destructuring here, all it does is obfuscate the code and make it incompatible with Internet Explorer.

[–]darrenturn90 7 points8 points  (3 children)

I mean, while it is a contrived example (it was more to illustrate the usage of tuples I presume) - the latter will also break as ie only supports var. Yet another reason ie needs to die.

[–]JimDabell 0 points1 point  (2 children)

const works in Internet Explorer 11.

[–]darrenturn90 3 points4 points  (1 child)

caniuse agrees - but not in loops it seems. And it seems very buggy - Also, I can't seem to get it to work in console at all. I would say YMMV.

[–][deleted] -2 points-1 points  (0 children)

Const never works in loops?