What is the most appropriate way to test if a variable is undefined in JavaScript?
$.ajax({
type: method,
url: url,
success: function (data) {
if (form != null || form != undefined){
data = $(form).serialize();
}
var json = JSON.parse(data),
list = $(table).html(),
compileTemplate = Handlebars.compile(list),
result = compileTemplate(json),
content = doc.getElementById(element);
content.innerHTML = result;
},
dataType: "text"
});
I'm looking for a more beautiful way for this check.