calculator-using-js-modules-finished

calculator-using-js-modules-finished--malvoliothegood.repl.co
9 runs
This repl has no cover image
Details
Created on Feb 3, 2021
No reactions yet
1comment
to comment
xxpertHacker4 months ago

Just a tip, globalThis.isNaN coerces it's input to a number via toNumber. Usually, this is unintentional on the JS developer's side; you might want to parse the number first, then check if it's a nan, since currently this is a double operation.

const inputNumber = Number.parseFloat(element.value.trim());

if (Number.isNaN(inputNumber)) {
  return null;
}

return inputNumber;