get the sign of a number. you'll get a 1 for positive numbers (or zero), and -1 otherwise.
1
-1
this function is faster than Math.sign as it uses the ternary conditional operator, which makes it highly JIT optimized.
Math.sign
get the sign of a number. you'll get a
1for positive numbers (or zero), and-1otherwise.this function is faster than
Math.signas it uses the ternary conditional operator, which makes it highly JIT optimized.