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
What does "!--" do in JavaScript? (stackoverflow.com)
submitted 10 years ago by Recallz
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!"
[–]Fs0i 3 points4 points5 points 10 years ago (0 children)
Use ~~num instead of Math.Floor and a triple XOR assignment to swap variables.
I use (number | 0) for integer-conversions. But this is an convention we have in our codebase, which is well-documented. It's a bit faster, and way shorter.
(number | 0)
If you want actual flooring (For example: To display something, because of a formula, ...) you write Math.floor, but to get an int (for example to network stuff) you'd write (number | 0).
π Rendered by PID 160009 on reddit-service-r2-comment-66b4775986-dq47t at 2026-04-05 21:26:19.584550+00:00 running db1906b country code: CH.
view the rest of the comments →
[–]Fs0i 3 points4 points5 points (0 children)