Hi I’m very new to JS.
Lets say I have an object named test which doesn’t have a property missing. But I try to access the same:
test.missing //getting undefined as output
Now I’m trying to access the missing properties ( like this test.missing.404 ) which will give me a TypeError. But my book says we can get rid of this TypeError by like this:
test.missing && test.missing.404
Now my big question is how one can do a && against the undefined type and TypeError type. Couldn’t able to guess what Js is doing here.
Thanks in advance.
undefinedin js is treated asfalseand if something has value it is treated astrue, so: