percentage-difference

Return the percentage difference between two numbers, optionally rounding.

Usage no npm install needed!

<script type="module">
  import percentageDifference from 'https://cdn.skypack.dev/percentage-difference';
</script>

README

PercentageDifference - JavaScript

Return the percentage difference between two numbers, optionally rounding.

Installation

npm install percentage-difference

Usage

percentDiff(base, peak[, round])
const {percentDiff} = require('percentage-difference');

console.log( percentDiff(600, 700); // 16.666666666666664
console.log( percentDiff(600, 700, true); // 17
console.log( percentDiff(700, 600, true); // -14