Anyone working with the language will be inevitably regularly reminded which these are.
The least mentioned is NaN followed up by... false. But I can't blame anyone for forgetting that one, as it's too obvious.
Anyone working with the language will be inevitably regularly reminded which these are.
The least mentioned is NaN followed up by... false. But I can't blame anyone for forgetting that one, as it's too obvious.
But it's just very much asking around https://javascriptwtf.com/ level stuff
Especially when you deal with unsanitized data - like from a 3rd party API - you're bound to eventually have each of those cases find their way into your if statements/expressions.
Also, this question works for other languages too, as e.g. NaN can evaluate to True (Python) or have an undefined behaviour but still evaluate to true (C, C++) - it's useful to know what is true and what is false(y) in your language of choice, especially coming from another language.
To make it worse, there is a "truthy" too.
I guess a technical question. But my eyes.
How did I do?
Personally I've never had an issue where that would matter, as BigInt is typically used mostly in isolation. Any avenue for errors appears only when types are mixed or used in boolean statements.