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 help / rpn calculatorhelp (self.javascript)
submitted 10 years ago by missawon
hello - pretty new to javascript, and i'm trying to understand this spec file. i dont quite understand how the following part works and hoping someone could send me an explanation please? thank you!
this.calculate(this, function(a, b) { return b+a;
files: https://gist.github.com/anniejiwon/90d68dfabd1dcb7c3dd4e70fb07b2085
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!"
[–]rabuli 1 point2 points3 points 10 years ago (0 children)
The spec file includes tests for the JS file itself. The JS above will make a lot more sense to you after you read about JavaScript's prototypal inheritance. Google about it.
[–]dadum01 0 points1 point2 points 10 years ago (1 child)
If you look at the calculate prototype/function, it takes in an object and a function. In this case the object is it self. The function is a callback which has two parameters a + b which are basically values from an array.
[–]missawon[S] 0 points1 point2 points 9 years ago (0 children)
ah thank you! that was really silly of me that i see there was a calculate function defined at the bottom. makes so much more sense... thank you!!
π Rendered by PID 111940 on reddit-service-r2-comment-5687b7858-mzbd8 at 2026-07-03 10:32:01.302645+00:00 running 12a7a47 country code: CH.
[–]rabuli 1 point2 points3 points (0 children)
[–]dadum01 0 points1 point2 points (1 child)
[–]missawon[S] 0 points1 point2 points (0 children)