JavaScript: Array.splice