~~ can be used instead of Math.floor and is actually (I believe) faster
~~
Math.floor
Oh nice! I didn't know that, cool :o
~~ truncates, which rounds towards 0. Math.floor rounds towards -∞.
> ~~(-1.2) -1 > Math.floor(-1.2) -2
Yup, I should have added that small caveat
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
~~
can be used instead ofMath.floor
and is actually (I believe) fasterOh nice! I didn't know that, cool :o
~~
truncates, which rounds towards 0.Math.floor
rounds towards -∞.Yup, I should have added that small caveat