There are a variety of ways, but the following methods seem to be the best.
if($.type(val) === "undefined"){ //Some code goes here }