Thanks for this addition. Nullish coalescing operator (??) and optional chaining (?.) are indeed very useful. Nevertheless, the real check for undefined is the one I've described. If you want to check if the property is undefined like in my example - a simple if-statement with typeof is the way to go.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for this addition. Nullish coalescing operator (
??
) and optional chaining (?.
) are indeed very useful. Nevertheless, the real check forundefined
is the one I've described. If you want to check if the property isundefined
like in my example - a simpleif
-statement withtypeof
is the way to go.