Whats the easiest way (with \"native\" javascript) to duplicate every element in a javascript array?
The order matters.
For example:
Basically:
a = [2, 3, 1, 4]; b=[]; for(var i = 0; i< a.length;++i){ b.push(a[i]); b.push(a[i]); } a=b;