The JavaScript array removes elements with Array.splice (start, deletecount);
-----------------------------------------------------
deleteWould delete the object property, but would not be reindex the array or update its length. This makes it appears as if it is undefined:
>MyArray= [A, ' B ', ' C ' , ' d ' [ "a" , "B" , "C" , "D" ]>delete Myarray[0]< Span class= "PLN" > true> Myarray[0] undefined
Note that it's not on fact set to the value undefined , rather the removed from the array, making it appear undefined. The Chrome dev tools make this distinction clear by printing when empty logging the array.
> myArray[0] undefined> myArray [empty, "b", "c", "d"]
myArray.splice(start, deleteCount)Actually removes the element, reindexes the array, and changes its length.
>MyArray= [A, ' B ', C, ' d '] [A, "B" , "C" , "D" ]> Myarray. (0, 2 [ "a" , "B" ]> MyArray [ "C" , "D" ]
Deleting array elements in Javascript-delete vs splice