I'm getting an Uncaught SyntaxError: Invalid left-hand side in assignment
error for
[d1,d2] =[d2,d1];
Anyone know why?
I'm getting an Uncaught SyntaxError: Invalid left-hand side in assignment
error for
[d1,d2] =[d2,d1];
Anyone know why?
You have probably done a good try by looking at other posts here at SO, since your code looks much like the one at this comment.
Unfortunately, the feature you use runs with ECMAScript 6, and that isn't supported on all browsers (yet) as you can see here and more specific this one.
You should use the code in the answer this comment was under.
d2 = [d1, d1 = d2][0];
To run this code you must wait for ECMA6 implementation - http://www.2ality.com/2014/06/es6-multiple-return-values.html