Although this is very simple, but should also have some people confused ~

Array.prototype.splice() 1.Array.prototype.splice()

Syntax :(1) array.splice(start) (2)array.splice(start, deleteCount) (3)array.splice(start, deleteCount, item1, item2)

The first parameter is start, which indicates the number of elements in the index. The second parameter is deleteCount, which indicates the number of elements deleted. (3) The third parameter is add content, if the element is not removed, add elements to it, starting from start.

So, the splice method uses the deleteCount parameter to control deletion or additionCopy the code

2.String.prototype.split() First this is a String method that returns an array

1. Str.split ([separator[, limit]])

The separator argument :(1) the first argument is the string (which can be a string or regular expression) that represents each point at which the split occurs. (2) the second argument is an integer that limits the number of split fragments to be returned

So split () returns an array containing an empty string, not an empty array, or an empty array if both the string and delimiter are empty strings.Copy the code