While experimenting with some different methods of generating JavaScript arrays, I came across a strange result. Using map to push array of self-references ( DEMO ):
a=[1,1,1,1,1,1,1,1,1,1]; a=a.map(a.push,a);
I get the following result (in Chrome):
[13,16,19,22,25,28,31,34,37,40]
Can someone explain why?
source share