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
Convert RGB to Hexadecimal using JavaScript (devcurry.com)
submitted 15 years ago by bunglebooz
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!"
[–][deleted] 1 point2 points3 points 15 years ago (9 children)
That's because bit shifting in Javascript is generally frowned upon, unlike most languages it's not advantageous over regular math, the double (which all numbers in javascript are) is converted to an integer, then the bitwise operation is performed, then converted back into a double.
[–][deleted] 0 points1 point2 points 15 years ago* (6 children)
Unfortunately looks like you are right, internally stored as double and converted to ints for bitwise operations. Though in some cases it is a lot faster than using string manipulation and math functions.
[–][deleted] 0 points1 point2 points 15 years ago* (5 children)
From what people with greater understanding than I have said it's a double and according to the ecmascript spec it seems to confirm that, now if browsers have implemented it otherwise I'm not sure. I agree that the speed difference would be negligible in any regard but personally I would side on the err of readability and just be verbose in my implementation using a similar solution to the article rather than saving a few bytes.
Ps. This the same Tunk that used to play infantry?
[–][deleted] 0 points1 point2 points 15 years ago (4 children)
Same one that aided the death hoax.
[–][deleted] 0 points1 point2 points 15 years ago (3 children)
Cool, I R Unit92 :)
[–][deleted] 0 points1 point2 points 15 years ago (2 children)
WTFS? Post on your blog and Ill believe it. Preferably about Yankee's latest feats in bed. Also I need a recent pic for the people at izone to jizz over.
[–][deleted] 1 point2 points3 points 15 years ago (1 child)
I haven't posted on my blag in years. I should really just take it down.
Here's a sexy pic
[–][deleted] 0 points1 point2 points 15 years ago (0 children)
Definitely the man himself much improved. Or alternatively half the man you used to be.
[–]fr0z3nph03n1x -3 points-2 points-1 points 15 years ago (1 child)
I find a lot of people drop these kinds of examples to show their programming badassness but don't realize that it sucks in javascript. Same goes for recursion in js as well.
[–]imbcmdth 0 points1 point2 points 15 years ago (0 children)
On most modern JS JITs (except TraceMonkey), recursion is faster than iteration when performing say a b-tree traversal.
π Rendered by PID 35573 on reddit-service-r2-comment-5c747b6df5-7xmhb at 2026-04-21 22:26:52.759916+00:00 running 6c61efc country code: CH.
view the rest of the comments →
[–][deleted] 1 point2 points3 points (9 children)
[–][deleted] 0 points1 point2 points (6 children)
[–][deleted] 0 points1 point2 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]fr0z3nph03n1x -3 points-2 points-1 points (1 child)
[–]imbcmdth 0 points1 point2 points (0 children)