This is my code :
var a=[1,2,3]
b=$.clone(a)
alert(b)
Doesn't jQuery have a 'clone' method? How can I clone an array using jQuery?
See Question&Answers more detail:osThis is my code :
var a=[1,2,3]
b=$.clone(a)
alert(b)
Doesn't jQuery have a 'clone' method? How can I clone an array using jQuery?
See Question&Answers more detail:osJust use Array.prototype.slice
.
a = [1];
b = a.slice();
JSFiddle - http://jsfiddle.net/neoswf/ebuk5/