This article mainly introduces the JavaScaipt array element deletion method delete and splice parsing. In the paper, the presentation is very detailed in the document, which has a certain reference value for everyone’s learning or work. Friends needed to refer to
First, delete an element (less)
in Delete: Delete: Only deleted elements become undefined, ie array length unchanged
are described with SPLICE : This method automatically changes the original array, that is, each SPLICE (I, 1) array length is automatically reduced by 1
var array = [“aa”, “DD” , “cc”, “aa”]; // method 2: Delete array elements array.splice (1, 1); // output: [“AA”, “CC”, “aa”]
AA CC AA
The above is this article All content, I hope to learn from everyoneHelped, I also hope that everyone will support Tumi Clouds.