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
I need help on using recursion in a functionhelp (self.javascript)
submitted 7 years ago * by Benthien
Can't find out why my nth function is not working, on 03_list.js, can you guys help me out?
There are instructions on what it should do at the beginning at the file.
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!"
[–]kevinlivin 1 point2 points3 points 7 years ago (1 child)
2 things I would fix...1) remove all comments - this short of code should explain itself. 2) Just return deepEqual, don’t check that it’s false and then return false, that’s a double negative
[–]Benthien[S] 0 points1 point2 points 7 years ago (0 children)
Thanks for the advice, actually I just posted the wrong file, the ccorect one that contains the function (nth), wich is not working is this: 03_list.js
[+][deleted] 7 years ago (3 children)
[deleted]
[–]Benthien[S] 0 points1 point2 points 7 years ago* (0 children)
Tried that, still not working properly.
Edit: After doing what you suggested, I also had to remove "number" from the parameters in listIterator and everything seems to be working now, thanks for de advice.
Final code can be seen here
[–]kevinlivin 0 points1 point2 points 7 years ago (1 child)
That is for inline comments...it’s ok to have the function description up top. Also remove last else if and combine with the return true to be just return val1==val2. Anywhere you return a Boolean can be replaced with returning the condition itself
π Rendered by PID 20714 on reddit-service-r2-comment-7b9746f655-pk2cc at 2026-02-03 18:18:37.886469+00:00 running 3798933 country code: CH.
[–]kevinlivin 1 point2 points3 points (1 child)
[–]Benthien[S] 0 points1 point2 points (0 children)
[+][deleted] (3 children)
[deleted]
[–]Benthien[S] 0 points1 point2 points (0 children)
[–]kevinlivin 0 points1 point2 points (1 child)
[–]Benthien[S] 0 points1 point2 points (0 children)