Shorthand Floor

We already know that there are lots of ways of rounding in JS. But did you know that there's a shorthand for Math.floor()?

If we use the Bitwise Operator ~ twice, we can floor a number.

let num = 1.13542345;
console.log(~~num);
// returns 1

No, I dont really understand how it works either. It's probably not a great thing to write in your code, because other people might not understand it either. But in case you do come across it, now you know what it means.