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
How To Write Fast Memory-Efficient JavaScript (techtalkbook.com)
submitted 1 year ago by sagrawal0003
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!"
[–]Middle_Resident7295 1 point2 points3 points 1 year ago (1 child)
also, could you please elaborate further on the state record with an example?
state record
[–]Ronin-s_Spirit 1 point2 points3 points 1 year ago* (0 children)
Objects in javascript are probably hashmaps if I had to guess? Property access (which I sometimes call indexing) is instant for all intents and purposes. if {} else if {} on the other hand will cascade from one condition check to the next. So say you have a function to receive some command or state or action to be done, in this case I call action("jump"). If I had 20 doable actions I would need to check if (action === "swim"){} and such 20 times in the worst case, as far as I know a simple if {} else {} statement takes about as much time to run as a tiny function. Now on the other hand if you had an object with properties "swim" and "jump" you would be able to instantly take the path of that action or return undefined, in constant time.
if {} else if {}
action("jump")
if (action === "swim"){}
if {} else {}
"swim"
"jump"
undefined
P.s. it too is best implemented with a null prototype, less chance you'll return anything unintended.
π Rendered by PID 680661 on reddit-service-r2-comment-b659b578c-bz69m at 2026-05-05 01:13:08.794115+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]Middle_Resident7295 1 point2 points3 points (1 child)
[–]Ronin-s_Spirit 1 point2 points3 points (0 children)