亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

JavaScript ??, null, ? ???? ??

typeof ???

typeof ???? ???? ??? ??? ??? ??? ? ????.

typeof? ????? ???? ???? ?? ?? "???? ??"???.
????? ?????. typeof(x) = "number"
String typeof(x) = "string"
Boolean ? typeof(x) = "boolean"
Object, array and null typeof(x) = "object"
Function typeof(x) = "function"

typeof ???? ??? ???? ??? ??? ???? ? ???? ??? ?????.
??? ???? "??", "???", "??", "??", "??" ? "???? ??"???.

?:
alert(typeof (123));//typeof(123)? "??"? ?????.
alert(typeof ("123"));//typeof("123")? "???"? ?????

typeof ?? ???? ??? ??? ???? ???? ?????.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php.cn</title>
</head>
<body>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = 
typeof "john" + "<br>" + 
typeof 3.14 + "<br>" +
typeof false + "<br>" +
typeof [1,2,3,4] + "<br>" +
typeof {name:'john', age:34};
</script>
</body>
</html>

Null

Null ? ??? ??? ???? ?? ??? ?????. ?? ??, ?? ??? ?? ??? ??? ?? ? JavaScript? ???? ??? ?? ?? ??? ?? ???? ?? ??? null???.

null ??? ????? ??? ??? null? ???? ???.

if( x == null ) { ... }

? ??? ?? ??? ???? , ?? ? ?? ??? ???? ??? ??? null ?? ???? ??? ??? ?? ? ????.

Undefine

??? ??? ? ??? ??? ?? ??? ?? ??? ???? ?? ?????. ???? ?? ??? ?? ?? ???? ????? ?? ?? ?? ??? ???? ?? ???? ????? ???? ?? ??? ???? ???.

if( x == undefine ) { ... }


???? ??? Null? ???

???? ?? ???? ???? ?? ?? ??? ????. ??? ??? ????? ?? ?? ??? ???? ???? ????.
Null ???? null ?? ??? ????. Null? ?? ???? ?? ??? ???? ? ?????. ??? ???? ?? ??? ????? ???? ???? ? ?? ?????.

undefine? ??? ???? ???? ?????? ?? ???? ???? ?????(????? ??). ?? ????? ???? ?? ?? ???? ??? ?? ??? ???? ???? ?? ?????. ?? ???? ???? ??? ?????.

null? "? ??"? ???? ????.

Javascript? ???? ?? ??? ???? ???? ???? ?????.

Javascript? ??? null? ???? ????. ?? ?????? var? ??? ??? ?? ??? ???? ? ?????.

undefine? ??? JSON? ???? null?

null ?????. ;

??? ?? ?? ?????.

??? ?? ?????(Boolean(undefine) ->// false, Boolean(null) ->// false);

??? ?? ??? ??? ? ????. ???? ???? ?????. typeof ?? === "undefine";

? ???? ??? null?? ??? ? ????. ?? === null;

?? ??? ??? ? ?????(null==???? ?? ->// true), ?? ??? ??? ? ???? ????(null===undefine->// false)

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php.cn</title>
</head>
<body>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
typeof undefined + "<br>" +
typeof null + "<br>" +
(null === undefined) + "<br>" +
(null == undefined);
</script>
</body>
</html>


???? ??
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <script type="text/javascript"> function aFunction(iNum1) { if (typeof iNum1 == "number" ){ alert("number"); } if ( typeof iNum1 == "string") { alert("string"); } } aFunction("a"); aFunction(1); </script> </head> <body> </body> </html>