How to use the splice () method in JavaScript
This article mainly shows you "how to use the splice () method in JavaScript". The content is simple and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn this article "how to use the splice () method in JavaScript".
Splice ()
Add / remove elements from the array.
Var str1 = [1 0'console.log 2 3)] / / delete 2 console.log (str1.splice (1 minute 2), str1) starting from index 1; / / [2 meme 3], [1, 4 parry 5 pension6] / / add, from index 1 to index 2, replace it with '0'console.log (1, 2), str1) / / [2, 3], [1,'0,'0, 4, 5, 6] these are all the contents of the article "how to use the splice () method in JavaScript". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!