The right-hand side of an Elvis operator can be any expression. This includes
things like return
and throw
. This is a way of doing null
checking deeper
into some object (e.g., checking to see if a property or function returns null
)
as a form of "defensive programming".
You can learn more about this in:
Tags: