There are 6 falsy values in JS, but since we (usually) don’t (want to) assign these types of values, does that mean
undefined — and other falsy values (eg. NaN) — are errors?
Falsy values are not necessarily errors.
I guess if you performed an operation such as dividing two strings, NaN would be an error.
However, if you were checking whether a variable exists (and a possible value is undefined), it wouldn’t be an error because the code is still performing as expected.
Hope that helps.
Hmm yes, that does help, thank you! A follow-up question to your answer… does that mean we should avoid falsy errors, or is it sometimes a good thing to get an