1//var a = [n/a];
2//A.splice (0); 3//Console.log (a); >>[]
4//A.splice (1); 5//Console.log (a); >>[1]
6//A.splice (0,1); 7//Console.log (a); >>[2,3]
The first parameter represents starting from the beginning, the second parameter means deleting a few, if not written, or just writing a parameter 0, will delete all.
1//var a = [[+]
2//A.splice (0,0,6); 3//Console.log (a); >>[6, 1, 2, 3]
The third parameter indicates that a value is added, which is represented in this line of code, starting with the No. 0, deleting 0 values and adding a 6 from the No. 0 index.
1//var a = [1,2,3]2//A.splice (0,1,6); 3//Console.log (a); >>[6, 2, 3]4//A.splice (1,1,6); 5//Console.log (a); >>[1, 6, 3]
If the second argument is not written in 0, then the third argument can be used as a replacement, which is, of course, a small trick.
1//A.splice (1,0,1.1,1.2,1.3); 2//Console.log (a); >>[1, 1.1, 1.2, 1.3, 2, 3]
You can add an arbitrary value after the second argument
A powerful function of an array splice,[, delete, change]