本文介绍了“未定义的”值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我最近很困惑(这就是我的生活)关于 " undefined"值。我查看了常见问题解答,并没有看到任何关于 的信息。在 http://www.webreference.com/programm ... pt / gr / column9 / 他们说: < snip> 未定义的属性 JavaScript的一个相对较新的添加是未定义的属性。 当你想测试一个变量是否已经初始化或者是b $ b时它是有用的没有。 var a; if(a == undefined)a =" some value" ;; < / snip> 这真的有效吗?不应该是if(a ==''undefined''的类型)? 对未定义的解释是什么?是和怎么检查它是 a好常见问题解答? 谢谢, 马蒂。Hi,I recently got very confused (well that''s my life) about the"undefined" value. I looked in the FAQ and didn''t see anything aboutit. On http://www.webreference.com/programm...pt/gr/column9/they say:<snip>The undefined propertyA relatively recent addition to JavaScript is the undefined property.It''s useful when you want to test whether a variable has beeninitialized or not.var a;if ( a == undefined ) a = "some value";</snip>Is this really valid? Shouldn''t it be "if (typeof a == ''undefined'') ?Would an explanation on what "undefined" is and how to check for it bea good entry for the FAQ?Thanks,Matty.推荐答案 我不这么认为,因为我不认为这是一个经常被问到的 这里的问题以及任何能够阅读和理解参考资料的人 和FAQ中指出的规格知道 支持的(低)水平与`typeof ... =='undefined"''相比。 PointedEarsI do not think so as I do not perceive it as a frequently askedquestion here and anyone who can read and understand the referencesand specifications pointed to in the FAQ knows the (low) level ofsupport for it compared to `typeof ... == "undefined"''.PointedEars 谢谢。但是有什么错误? Matty。Thank you. But what bugs?Matty. 这篇关于“未定义的”值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!