I want to push all individual elements of a source array onto a target array,
target.push(source);
puts just source\'s reference on the tar
apply does what you want:
var target = [1,2]; var source = [3,4,5]; target.push.apply(target, source); alert(target); // 1, 2, 3, 4, 5
MDC - apply Calls a function with a given this value and arguments provided as an array.
MDC - apply
Calls a function with a given this value and arguments provided as an array.