~~ is faster.
Consider we have a
pi variable that equals to
3.14 and we want to round it downward. So we can do:
var rounded = ~~pi; //result: 3
var rounded = Math.floor(pi); //result: 3
Online benchmark: http://jsperf.com/math-round-vs