Javascript integer to integer division will product decimal number
parseInt(1) / parseInt(2)
// 0.5
parseInt(0.5)
// 0
Math.ceil(1/2) (Decimal 0.5's ceiling)
// 1
Javascript int and decimal are type "numbers"
typeof(1)
// "number"
typeof(parseInt(1))
// "number"
typeof(0.5)
// "number"
No comments:
Post a Comment