Hi if i have a number like 2.345645 and i only require .34 how would one get only the decimal to the hundreth ?
var num = 2.345645;
.34 or .35 if rounding applied; rounding does no affect me that much so i don't care if its applied.
Thanks!
Printable View
Hi if i have a number like 2.345645 and i only require .34 how would one get only the decimal to the hundreth ?
var num = 2.345645;
.34 or .35 if rounding applied; rounding does no affect me that much so i don't care if its applied.
Thanks!
Multiply it by 100, Math.round and divide it by 100.
hi, did something different:
math.floor(num)-num
thanks for teaching me math.floor !