Closed JohnBrinkman closed 10 months ago
Note that with these changes:
toNumber("nn")
returns null
, but toNumber(toNumber("nn"))
returns zeronull
parameter as if it were omitted. e.g. [1,2,3][0:null():1]
is the same as [1,2,3][0::1]
. However ... the spec does not describe this behavior, and in fact says that slice parameters are coerced to number
Currently if
toNumber()
cannot convert a string to a number, it returns0
. But this doesn't allow the author to know if a conversion failed -- or if the string really was a zero. Instead, we should:toNumber()
failure returnnull
null
to number returns zero. That would also mean thetoNumber(null())
will return 0.