[Solved] Get the percentage of a number with javascript [closed]


This is a math question, not programming, but you ask for javascript here you are an example:

var value = 249;
var total = 1000;

var calcPercent = function(v, t) {
  return 100*v/t;
};

alert(calcPercent(value, total)+"%");

solved Get the percentage of a number with javascript [closed]