how to calculate percentage difference of 2 numbers in js code example
Example: 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