|
|
Q535 Is there a way I could drop the decimal point in a fraction and make it a whole number?
irt.org | Knowledge Base | JavaScript | Number | Q535 [ previous next ] Q535 Is there a way I could drop the decimal point in a fraction and make it a whole number?Use the Math object's floor method:
Simon Bate writes: The solution doesn't tell the whole story, because if the number is negative, Math.floor will return the next LOWER integer, which is probably not a desirable result. The answer should really be implemented as:
Feedback on 'Q535 Is there a way I could drop the decimal point in a fraction and make it a whole number?' |
-- div -->
|