javascript How I want to add data to my desired location in array?
This question already has an answer here:
You're looking for the .splice()
method for arrays. Read about it here.
For your example, it would be something like
arr.splice(2,0,'@')
This says "go to element 2 of the array, remove 0 elements, and add the element '@'".
链接地址: http://www.djcxy.com/p/29320.html