Mr Speaker

3 Comments

  1. You clearly have too much time on your hands. Extremely cool.

    Monday, January 18, 2010 at 7:27 pm | Permalink
  2. In your code I noticed you used a funtion name “~~()”. Can you explain what this function does and if it is a part of the core Javascript language.

    Thanks

    Friday, January 22, 2010 at 4:32 pm | Permalink
  3. That’s just a lil’ trick: the ~ is JavaScript’s bitwise NOT operator. Applying it twice (NOT NOT) is just a cheeky way of doing a Math.floor for positive numbers. But it’s waaaay faster than “Math.floor” (and just slightly faster than “<<0″)

    Though in this case, speed is not really an issue and I should have just done Math.floor for readability. Sorry 'bout that!

    Friday, January 22, 2010 at 4:46 pm | Permalink
Captcha! Please type 'radical' here: *
How did you find this thingo? *