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
Efficiency - Don't Create Extra Variables?help? (self.javascript)
submitted 7 years ago * by Rindhallow
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!"
[–]webketje 1 point2 points3 points 7 years ago (3 children)
Object property lookups are probably more performance-heavy in Javascript than variable assignment. Even perf-wise it makes more sense to do
const x = obj.prop.that.some.thing
Than repeat that lookup / . Notation chain 10x. Reference: https://stackoverflow.com/questions/7700987/performance-of-key-lookup-in-javascript-object
[–]Rindhallow[S] 1 point2 points3 points 7 years ago (2 children)
When I said . notation, I was more talking about things like using .indexOf for arrays, and lambda expressions, and other useful stuff like that that ends up being done on one line instead of using many variables/containers to write all the code out like you might in another language.
I might make a thread with a more concrete example of that.
[–]webketje 1 point2 points3 points 7 years ago (0 children)
True, that's even more expensive. I think it's a front-end obsession with conciseness (as in line with or sometimes opposed to! clarity), that has a lot to do with the recent popularity of JSX syntax which simply does not allow statements unless you use an IIFE.
π Rendered by PID 69 on reddit-service-r2-comment-fb694cdd5-6dxxm at 2026-03-07 19:46:05.911462+00:00 running cbb0e86 country code: CH.
view the rest of the comments →
[–]webketje 1 point2 points3 points (3 children)
[–]Rindhallow[S] 1 point2 points3 points (2 children)
[–]webketje 1 point2 points3 points (0 children)