javascript js splice - What's the use of, 0)?

1 Answers

What's happening here is that Sizzle is creating an actual array out of an array-like object. The array-like object doesn't necessarily have the slice() method, so the prototype method has to be called directly. makeArray() returns a copy of that array-like object that is an actual array, and can be used as such else where.

See here for more information about array-like objects.

string vs

I was just browsing Sizzle's source code and I came across this line of code:

array = array, 0 );

I looked up what the function is, but I came to the conclusion that it just returns all elements of the array starting from index 0, and puts the whole into the array, i.e. it doesn't really do anything at all.

What is therefore the use of this line of code? What am I missing?

Edit: It's line 863 from