Using Array#splice in this way actually works because the start parameter is the last item, and since you've omitted the deleteCount parameter it will remove everything from start to the end of the array - the last item.
I think that the NaN you describe is cause by the return value of Array#slice. Slice returns an array that contains the deleted element(s), and you're probably trying to use this array as a number.
Example:
var lettersA = ['angel', 'clown', 'mandarin', 'sturgeon']; console.log("removed element: ", lettersA.splice(lettersA.length-1)); console.log("Array: ", lettersA);
If you want to get the removed value use Array#pop. Array#pop returns the removed element, without wrapping it in an array.
Example:
var lettersA = ['angel', 'clown', 'mandarin', 'sturgeon']; console.log("Removed element :", lettersA.pop()); console.log("Array: ", lettersA);
lettersA.splice(-1,1);or if its just a single elementlettersA.pop();lettersA.splice(lettersA.length-1);should also work though.NaN, your debugging, which we can't see? Please elaborate your question.NaNimplies Not a Number - is lettersA definitely an array and not an object?