I am wondering how in javascript if i was given a number (say 10000) and then was given a percentage (say 35.8%)
how would I work out how much that is (eg 3580)
var result = (35.8 / 100) * 10000;
(Thank you jball for this change of order of operations. I didn't consider it).
In JavaScript, how do I get: The whole number of times a given integer goes into another? The remainder?
I have the following JavaScript syntax: var discount = Math.round(100 - (price / listprice) * 100); This rounds up to the whole number. How can I return the result with two decimal places?
Is this defined by the language? Is there a defined maximum? Is it different in different browsers?