JavaScript
Jump to navigation
Jump to search
Clone an array with slice
var a = [ 1, 2, 3 ]; var b = a.slice( 0 ); WScript.StdOut.WriteLine( b ); // 1, 2, 3 WScript.StdOut.WriteLine( a == b ); // False
var a = [ 1, 2, 3 ]; var b = a.slice( 0 ); WScript.StdOut.WriteLine( b ); // 1, 2, 3 WScript.StdOut.WriteLine( a == b ); // False