Mittwoch, 7. November 2012

Rounding Integer in Javascript

There are a few options available when it comes to rounding a positive Integer value down in javascript.

  1. Math.floor()
  2. ~~
  3. >> 0


The third option is at least in Firefox a huge performance gain, you may check for yourself, have a look at this  JSPERF .

Keine Kommentare:

Kommentar veröffentlichen