As you can see my comment, I’m not sure why I’m getting an empty array and not [‘dog’, ‘cat’, foo’, ‘bar’]
var list = ["foo", "bar"];
function addElements(startIndex, itemsToDelete, item1, item2) {
var newArray = list.splice(startIndex, itemsToDelete, item1, item2)
return newArray
}
addElements(0, 0, "dog", "cat") // why does it return an empty array and not ['dog', 'cat', 'foo', 'bar']?