Why use [].slice.call() #31152
Answered
by
rohit2sharma95
ZhangChengLin
asked this question in
General
-
https://github.com/twbs/bootstrap/blob/v5.0.0-alpha1/site/content/docs/5.0/components/navs.md#L529
Why use this way of writing, just use the following "document.querySelectorAll('#myTab a')"? |
Beta Was this translation helpful? Give feedback.
Answered by
rohit2sharma95
Jun 23, 2020
Replies: 2 comments 4 replies
-
|
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
ZhangChengLin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Array.prototype.slice.call
is one way to convert the NodeList into a real array so that you can use the methods fromArray.prototype
. NodeList acts like an array, but doesn’t have the methods fromArray.prototype
.