词条 | undefined |
释义 | undefined 可用性用法 undefined 参数无。 返回 无。 说明一个特殊值,通常用于指示变量尚未赋值。对未定义值的引用返回特殊值 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”,而不转换为空字符串。这是动作脚本与 ECMA-262 规范之间的差异。 Undefined 百度贴吧一个神奇的贴吧。 部分贴吧吧友由于进行刷新、只看楼主、删帖等等操作,瞬间原始页面变成了undefined吧页面。 吧友称此现象为“穿越”。 穿越的吧友被认为是“被度娘看上的人”。 至于“为什么会穿越?”这种被许多穿越者问过的问题引起了诸多猜测,目前较为靠谱的说法如下; 吧名单词Undefined 是未找到的意思, 服务器处理大量数据 ,或者异常 ,或者传输服务丢包的时候,往往找不到传输的资料 ,这时服务器会弹出undefined的提示,百度出现异常时,地址识别就把undefined作为一个文字段处理。如果没有这个贴吧,各位也许只会看到“抱歉,根据相关法律法规和政策,本吧暂不开放。”,百度开发过程中异常都跳入这个贴吧了, 所以出现了“穿越”现象。 目前的穿越方式有: F5 鼠标刷新 只看楼主+登陆 点击进入帖子 翻页 删帖 回复主题 发帖(帖子会自己穿越……) 进入i贴吧(顺便说明可能会进入undefined的i贴吧……) …… |
随便看 |
百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。