Categories


Authors

Trick of the day: The Double Bitwise Not

Ever need to drop some points (decimals), like they were dead weight ...or live weight around your waist preventing you from fitting into that one outfit? 

If you ignore that bad analogy, you can see some examples of the long way round below:

var a = 4.9
Math.floor(a) //4

//OR

parseInt(a)//4

That's not a lot of code, but then check this out! 

var a = 4.9
~~a //4

How cool is that?!?! Let me know what you think. 


http://james.padolsey.com/javascript/double-bitwise-not/

Hackathons: A shot of experience

Hackathons: A shot of experience

Don't add that feature

Don't add that feature