Pure function

PHOTO EMBED

Tue Feb 09 2021 06:42:44 GMT+0000 (UTC)

Saved by @noobj

const assert = require('assert');

const getSavingsAmount = (amount, interestRate) => {
  return amount + amount * (interestRate / 100);
};

assert(getSavingsAmount(100, 3) === 103);
assert(getSavingsAmount(100, 2) === 102);
assert(getSavingsAmount(100, 4) === 104); 
content_copyCOPY