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

But what the heck is it? It’s not really that complicated. Think of undefined as the value assigned to things that don’t yet have a value (in other words they haven’t been initialized).

So what good is it? Well, undefined gives you a way to test to see if a variable (or property, or array item) has been given a value. Let’s look at a couple of examples, starting with an unassigned variable:

image with no caption


Cover of Head First JavaScript Programming


What is Undefined? A tip: undefined is anything that either has not been (initialized/declared/defined) or (anything that has not been given a value)