Today I learned about the valueAsNumber property of html number inputs.

So instead of having to parse the value like: const num = parseFloat(e.target.value)

You can do: const num = e.target.valueAsNumber

For example in react:

return (
    <input
      type="number"
      value={number}
      onChange={(e) => {
        // ✅
        const num = e.target.valueAsNumber
        setNumber(num)
      }}
    />
  )

Work With Number and Date Inputs in JavaScript