(name is undefined)
You: What is name
?
(你: name
什么?)
(*) ((*))
JavaScript: name
?
(JavaScript: name
?)
What's a name
? (叫什么name
?)
I don't know what you're talking about. (我不知道你在说什么)
You haven't ever mentioned any name
before. (您以前从未提到过任何name
。)
Are you seeing some other scripting language on the (client-)side? (您是否在(客户端)看到其他脚本语言?)
name = null;
You: What is name
?
(你: name
什么?)
JavaScript: I don't know.
(JavaScript:我不知道。)
In short;
(简而言之;)
undefined
is where no notion of the thing exists; (undefined
是不存在事物的概念的地方;)
it has no type, and it's never been referenced before in that scope; (它没有类型,并且在该范围内从未被引用过;)
null
is where the thing is known to exist, but it's not known what the value is. (null
是已知的事物存在的地方,但是它的值是未知的。)
One thing to remember is that null
is not, conceptually, the same as false
or ""
or such, even if they equate after type casting, ie
(要记住的一件事是,从概念上讲, null
与false
或""
等并不相同,即使它们在类型转换之后相等,即)
name = false;
You: What is name
?
(你: name
什么?)
JavaScript: Boolean false.
(JavaScript:布尔值false。)
name = '';
You: What is name
?
(你: name
什么?)
JavaScript: Empty string
(JavaScript:空字符串)
*: name
in this context is meant as a variable which has never been defined.
(*:在此上下文中, name
含义是从未定义的变量。)
It could be any undefined variable, however, name is a property of just about any HTML form element. (它可以是任何未定义的变量,但是name几乎是任何HTML表单元素的属性。)
It goes way, way back and was instituted well before id. (它沿路前进,早在id之前就已建立。)
It is useful because ids must be unique but names do not have to be. (这很有用,因为id必须是唯一的,但名称不必是唯一的。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…