How to create an if statement in javascript that will run if a variable is undefined?
本问题已经有最佳答案,请猛点这里访问。
Possible Duplicate:
Detecting an undefined object property in JavaScript
会是这样吗?
1 | if(variable == undefined) { |
还是像这样?
1 | if(variable =="undefined") { |
1 | if (typeof variable == 'undefined') |
1 | if(typeof(variable) == 'undefined') |
这里使用的
1 | if(typeof variable =="undefined") { |
第一个一 </P >
1 | if (variable == undefined) {} |
1 | if(variable == undefined) { |