Answers for "percentage difference between two numbers javascript"

4

js difference between two numbers

var difference = function (a, b) { return Math.abs(a - b); }
Posted by: Guest on February-21-2020
-1

percentatge difference between two numbers javascript

function relDiff(a, b) {
 return  100 * Math.abs( ( a - b ) / ( (a+b)/2 ) );
}
// example
relDiff(11240, 11192); //=> 0.42796005706134094
Posted by: Guest on November-11-2020

Code answers related to "percentage difference between two numbers javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language