Math.floor quick and easy
To quickly round a float on floor, you can use bitwise operation:
~~1.5 -> 1
~~2.9 -> 2
~~1.1 -> 1
This is a double bitwise NOT, so the processing is also faster.
Here (http://jsperf.com/round-floor-perf) you can test the processing speed
Written by jonathan de montalembert
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Performance
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#