I am trying to remove an entry from an array using array.splice(), using this bit of code:
let replaceThisArrRemoved = replaceThisArr.splice(positionNumber, 1);
When I use replaceThisArr = ["apple", "orange", "pear"] and positionNumber = 1, it will return replaceThisArr = ["apple", "", pear"].
I am trying to get it to return replaceThisArr = ["apple", "pear"]
Is there any other way of doing this, or anything wrong with my code that I should fix?
Advertisement
Answer
look at this console output –
