O'Reilly logo
  • Ahmed Elgendy thinks this is interesting:

How to use null

There are many functions and methods out there in the world that return objects, and you’ll often want to make sure what you’re getting back is a full-fledged object, and not null, just in case the function wasn’t able to find one or make one to return to you. You’ve already seen examples from the DOM where a test is needed:

image with no caption


Cover of Head First JavaScript Programming


How to use "null" to check if an object exists?