For example, an array is: var textArr = [ 'a', 'b', 'c', 'd'];
Then I want to delete this b element in the array:
Method one: delete delete array
delete textArr[1] 结果为: ["a",undefined,"c","d"]
Just deleted element becomes undefined keys or other elements unchanged.
Method Two: splice delete array
splice(index,len,[item])
Note: This method changes the original array.
index: Array index began
: len length of the replacement / deletion
item: replacement value, item deletion of empty words
textArr.splice (1,1); the result is: [ "a", "c", "d"] deleted directly change the value of the array of the array.