In order to duplicate an Array in Javascript,
does anyone know (and maybe tested) if it's faster to use slice method:
var dup_array = original_array.slice();
or doing a for loop:
for(var i = 0, l = original_array.lenght; i < l; ++i)
dup_array[i] = original_array[i];
UPDATE: (just to clarify myself) I know both ways do only a shallow copy: if original_array contains references to objects, objects won't be cloned, but only the references will be copied therefor both arrays will have refrences to the same objects. But this is not the point of this question.
I'm asking only about speed.