当前位置: 首页 > 网络学院 > 客户端脚本教程 > JavaScript > JavaScript undefined 属性
undefined |
In this example we will test two variables to find out if one of them is undefined:
在下面的例子中,我们将测试两个变量找出未被赋值的变量:
<script type="text/javascript"> var t1="" if (t1==undefined) {document.write("t1 is undefined")} </script> |
The output of the code above will be:
输出结果为:
t2 is undefined |
undefined
How to test if a variable is undefined.
如何测试一个变量是否未被赋值