mird150太牛了:undefined是什么意思

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/03 19:13:00

英文翻译的意思是:1. 不明确的,未下定义的2. 未阐明的;未限定的 在电脑方面:一个特殊值,通常用于指示变量尚未赋值。对未定义值的引用返回特殊值 undefined。动作脚本代码 typeof(undefined) 返回字符串 "undefined"。undefined 类型的唯一值是 undefined。 当将undefined 转换为字符串时,它转换为空字符串。undefined 值与特殊值 null 相似。事实上,当使用相等运算符对 null 和 undefined 进行比较时,它们的比较结果为相等。在这个示例中,变量 x 尚未声明,所以其值为 undefined。在代码的第一部分,使用相等运算符 (==) 比较 x 的值与值 undefined,并将相应的结果发送到输出窗口。在代码的第二部分,使用相等运算符比较值 null 与 undefined。 // x has not been declared trace ("The value of x is " + x); if (x == undefined) { trace ("x is undefined"); } else { trace ("x is not undefined"); } trace ("typeof (x) is " + typeof (x)); if (null == undefined) { trace ("null and undefined are equal"); } else { trace ("null and undefined are not equal"); } 下面的结果显示在输出窗口中: The value of x is x is undefined typeof (x) is undefined null and undefined are equal 注意:在 ECMA-262 规范中,将 undefined 转换为字符串“undefined”,而不转换为空字符串。

undefined: [ 'ʌndi'faind ]
未定义的