>
> * If you know that your input is either a string or null/undefined (e.g.,
> as the result of `someHTMLElement.getAttribute('foo')`), you could use
> `Number.parseFloat()`, which will produce NaN for the empty string, null
> and undefined.
>
Of course, `Number.parseFloat("23.4ducky")` results in `23.4`. Duan
indicated he/she wanted this `Number.of` to be more strict.
I, too, have wanted something *strict* that didn't convert `""` and `null`
to `0`. (Like many, I suspect, I have one in my toolkit; but the idea of
something in the standard library appeals.)
-- T.J.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss