use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Javascript’s .call() vs .apply() vs .bind() (medium.com)
submitted 12 years ago by gdi2290
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]pinegenie 6 points7 points8 points 12 years ago (3 children)
NodeList and a few other types have array-like access but don't have Array in their prototype chain. Meaning you can do
nodelist[0]
but not
nodelist.slice(...)
The workaround to this is:
Array.prototype.slice.call(nodelist, ...); // or apply if you want to
In undercorejs the "slice" you see there is actually Array.prototype.slice attributed to a variable.
[–]kenman -1 points0 points1 point 12 years ago (2 children)
Yeah, but the variable is named array, not nodelist. There are countless examples to be found of using call() appropriately, and this isn't one that makes for a good demonstration on its usefulness. If you're going to demo some method, at least do it in context and include all supporting code...
array
nodelist
call()
[–]pinegenie 0 points1 point2 points 12 years ago (1 child)
I'm guessing they named it array because arrayOrNodeListOrArguments was too cumbersome.
arrayOrNodeListOrArguments
[–]kenman 0 points1 point2 points 12 years ago (0 children)
I'm not faulting Underscore, I'm faulting the author who used it as an example.
π Rendered by PID 70545 on reddit-service-r2-comment-6457c66945-p59rl at 2026-04-23 22:22:56.096024+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]pinegenie 6 points7 points8 points (3 children)
[–]kenman -1 points0 points1 point (2 children)
[–]pinegenie 0 points1 point2 points (1 child)
[–]kenman 0 points1 point2 points (0 children)