The study found that there is a great difference between the two, I do not know from English, the two are different, the results are as follows
Test Os:ubuntu
Test Browser: Chrome
Test Case 1
Console.log (a)
Error REFERENCEERROR:A is not defined
Test Case 2
var a
Console.log (a)
No error, but output undefined
Test Case 2
var b = {};
Console.log (B.A)
No error, but output undefined
Test Case 3
Function C () {
}
var d = new C ();
Console.log (D.A)
No error, but show undefined
About typeof
All of the above objects used for testing are returned with typeof String ("undefined")
About or Operations | |
var d = a| | 3
Error a not defined
var A;
var d = A | | 3
Result: d==3
var c = 22 | | 44
C==22
var c = False | | 33
c = = 33
if (x) {
}
Error
var x
if (x) {
}
If not executed in
Summarize:
JS has two kinds of undefined although use typeof return is a String ("undefined")
after it is defined, but without any action or an undefined attribute of an object, it belongs to the undefined that can be used as a logical operation
the second variable, completely undefined, and without any background (X.A, although X has no a attribute, but gives X face), is an error type that cannot be used unless the TypeOf function
JS or operation, does not return the bool value, but return JS on both sides of the last calculation of the conditions, such as 1| | 2 1 is true, 2 does not need to be calculated, so 1| | 2 = 1 a| | 1 Error
var A; a| | 1 = 1;
I found a dictionary and translated it.
undefined can be translated into: not clear, that is, do not know what to do
and not defined can be translated into undefined