javascript: calculate x% of a number
This is what I would do:
// num is your number
// amount is your percentage
function per(num, amount){
return num*amount/100;
}
...
<html goes here>
...
alert(per(10000, 35.8));
var result = (35.8 / 100) * 10000;
(Thank you jball for this change of order of operations. I didn't consider it).