javascript percentage difference between two numbers after . only 2 number show 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