JavaScript: Array.splice()