How do I determine if variable is undefined
or null
?(如何确定变量是否undefined
或为null
?)
My code is as follows:(我的代码如下:)
var EmpName = $("div#esd-names div#name").attr('class');
if(EmpName == 'undefined'){
//DO SOMETHING
};
<div id="esd-names">
<div id="name"></div>
</div>
But if I do this, the JavaScript interpreter halts execution.(但是,如果执行此操作,JavaScript解释器将停止执行。)
ask by sadmicrowave translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…