I disagree, this code is highly readable. In fact, you'll feel right at home if you come from python world. The following piece of code to swap 2 variables is consider pythonic:
a,b=b,a
If you're worry allocating a temporary array causing performance issue, then you should stay away from JavaScript in the first place
I disagree, this code is highly readable. In fact, you'll feel right at home if you come from python world. The following piece of code to swap 2 variables is consider pythonic:
If you're worry allocating a temporary array causing performance issue, then you should stay away from JavaScript in the first place
The temporary array is most likely optimized away.
That's almost certain, iirc most of the array related code are written C++, at least for Chrome's V8 anyway