9 runs
This repl has no cover image
Created on Feb 3, 2021
No reactions yet
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;