-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add spread operator! #331
Comments
This should be an addition to the myArr.concat.apply(myArr, [1, 2, 3]);
// -->
myArr.concat(...[1, 2, 3]); but the following does not: Array.prototype.concat.apply(myArr, [1, 2, 3]) |
I suppose |
Yeah, that too. There is a problem though, which we need to watch out for. Sometimes function foo() {
// arguments variable
Array.prototype.slice.apply(arguments, []);
} // NodeList
var divs = document.getElementsByTagName("div");
Array.prototype.slice.apply(divs, []); I'm not sure how common such cases are, as one can often just use However, the mere possibility of these cases would render the |
Usually "apply" is used as a spread operator, here's an example
convert this
into
The text was updated successfully, but these errors were encountered: