Splice with array

How to replace part of an array with the contents of another array.

by Bhabani Raju

JavaScript

var arr = ['a', 'b', 'c'];
var anotherArr = [1, 2, 3];

Array.prototype.splice.apply(arr, [0,anotherArr.length].concat(anotherArr));

alert(arr);