Wondering what the <<
does in this:
Math.random() * Math.pow(36, 2) << 0
Not sure how to use that in practice.
Wondering what the <<
does in this:
Math.random() * Math.pow(36, 2) << 0
Not sure how to use that in practice.
It truncates the number / converts it to an integer. You can test this for yourself:
console.log(12.345 << 0); // 12
— This question is very similar to Why does a shift by 0 truncate the decimal?
Take a look at this
a = Math.pow(36, 2)
1296
a = Math.random() * a
477.5906135469167
a = a << 0
477