Use:
(采用:)
if (typeof something === "undefined") {
alert("something is undefined");
}
If an object variable which have some properties you can use same thing like this:
(如果对象变量具有某些属性,则可以使用类似的方法:)
if (typeof my_obj.someproperties === "undefined"){
console.log('the property is not available...'); // print into console
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…