I'm trying to splice array two from the two-dimensional array arr.
var one = ["a","b"];
var two = ["c","d"];
var thr = ["e","f"];
var arr = [one,two,thr];
var rem = arr.splice(1,1);
// This alerts the entire array as one long string "c,d".
// The expected behavior is "c" (index 0 of the returned array _rem_).
var rem = arr.splice(0);
// The array _rem_ is now correct, but _arr_ is left with an empty index: "a,b,,e,f".
var test = arr.slice(0);
Interesting observation. From the ECMA-specs (262, ed. 5):
When the splice method is called with two or more arguments start, deleteCount and (optionally) item1, item2, etc., the deleteCount elements of the array starting at array index start are replaced by the arguments item1, item2, etc. An Array object containing the deleted elements (if any) is returned.
Array.splice thus returns an array of the removed elements. So, if you want to reference the removed array, this should be the syntax:
var rem = arr.splice(1,1); alert(rem); //=> 'c'