javascript: calculate x% of a number

javascript, math

Solution

var result = (35.8 / 100) * 10000;

(Thank you jball for this change of order of operations. I didn't consider it).

Problem

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)

Original source