This works because JavaScript "short circuits" or
statements; when the first argument ( typeof msg.payload === 'undefined'
) is true
it does not proceed to check the second one (typeof msg.payload.condition
=== 'undefined'
), thereby avoiding an error should msg.payload
be undefined.
2 Likes