DEV Community

Cover image for NSFW: Use cases for Bitwise operators in Js

NSFW: Use cases for Bitwise operators in Js

Darkø Tasevski on November 29, 2018

Bitwise operators in Javascript are mostly used for numerical conversions/computations, because sometimes they're much faster than their Math or pa...
Collapse
 
mark_nicol profile image
Mark Nicol

Thank you for a great explaining article. As you say the performance gains vs legibility means it's more something worth understanding than using. Handy for the situations where someone else has used a trick like these without explanation.

Collapse
 
georgewl profile image
George WL

I still think there's no such thing as practical applications of bitwise operations.

They're mystery meat, fine if you're someone who knows what's in there, but dangerous and hard to understand for anyone else.

Collapse
 
larsklopstra profile image
Lars Klopstra ⚡

Thanks!!

Collapse
 
qm3ster profile image
Mihail Malo

For me in Chromium 71.0.3578 there were no performance differences.
Except parseInt was incredibly slower. "does it actually go through string" - one wonders.

Collapse
 
blarcmann profile image
yemiOdetola

great article! :)