I am familiar with using the following:
Array.prototype.slice.call(document.querySelectorAll('a'))
to convert Nodelist
data type to an array without specifying a parameter. However, I came across information from the W3CSchool regarding the usage of slice
, which mentions that the first parameter start
is required:
start Required. An integer that specifies where to start the selection (The first element has an index of 0). Use negative numbers to select from the end of an array
So, is it acceptable to not specify a parameter and still call that method successfully? How does this work?