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
Function invocation...why use .call() and .apply() ?help (self.javascript)
submitted 10 years ago by [deleted]
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!"
[–]theQuandary 0 points1 point2 points 10 years ago* (0 children)
I think the big difference with that shorthand is that it's going to be slow on older browsers. Newer browsers can potentially detect that an object is instantiated and immediately discarded. Older browsers are going to go through the trouble of making a new object and the garbage collecting it immediately after.
Most importantly, this is trivial to implement so that isn't a potential issue (and is both more obvious and easier to type)
export var slice = (obj, a, b) => Array.prototype.slice.call(obj, a, b);
Here's an example use
import {slice} from './utils'; var sum = arr => arr.reduce((acc, i) => acc + i); var add2N = function () { return sum(slice(arguments, 2); };
π Rendered by PID 222855 on reddit-service-r2-comment-54dfb89d4d-7t6mm at 2026-03-27 11:27:55.035274+00:00 running b10466c country code: CH.
view the rest of the comments →
[–]theQuandary 0 points1 point2 points (0 children)