September 24, 2006

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’)

Filed under: Javascript, Programming — Michi @ 2:01 am