Detecting Undefined Variables in JavaScript

This pops up every so often so I thought I’d dedicate a post to it. JavaScript has no “isset” function. Instead, your best bet is to use the following:

if((typeof theVariable) == ‘undefined’)