detect "null"
-
@ulrik I just skimmed through the JUCE codebase and the only time where
null
is used is when you convert a JSON object with a void field to a string (which would be the case if you do something likeConsole.print(trace(array)
command). I guess that's just for compatibility reasons with the JSON standard and it is still being typed internally asvoid
. I can't say why it is behaving like that with aninf
number though, as this is clearly a number type and should be treated as such (eg.isDefined(1.0/0.0)
returns true).However I got this output:
so apparently assigning
void
to a field is the same as assigningundefined
(which I thought were two different things), however theisDefined()
check works correctly on all of them.BTW, using
inf
as literal is not protected, so you can do stuff like:var inf = 90; Console.print(inf);
-
@Christoph-Hart Is it normal that
a[2]
set tonull
is throwingundefined
? It's weird to me because it is actually defined asnull
...EDIT: I think I have my answer...
console.log(null === undefined) // false (not the same type) console.log(null == undefined) // true (but the "same value")
-