JavaScript Data types
String, number, Boolean, array, object, Null, Undefined
1<! DOCTYPE html>234<meta charset= "UTF-8" >5<title></title>6<script>7 //The type of the variable is determined by the value of the variable.8 //Weakly typed languages9 Ten //string type, quoted as String type One //var userName = "Ghostwu"; A //var username= ' GHOSTWU '; - //How to view the type of a variable - //typeof + Name of the variable the //alert (typeof userName); String - - - //var age =; + //alert (typeof age); Number (numeric type) - + //var n = 0.2; A //alert (typeof N); at - - //Boolean type (true/false) - //var a = true; - //alert (true); - //alert (typeof true);//boolean in //var a = false; - //alert (typeof a);//boolean to + //var a = ' true ';//string - //var a = ' false ';//string the //alert (typeof a); * $ Panax Notoginseng //objects: Objects, a thing ... - //var a = document; the //alert (typeof a);//object (object) + A //var A; the //alert (a);//When declaring a variable, no value is given, then his value is undefined + //alert (typeof a);//type (undefined); - $ $ //var a = null; - //alert (a); - //alert (typeof null);//Empty Object the - Wuyi the varA = 10; -A = ' Hello '; WuAlerttypeofa); - About $ - -</script> - A<body> + the</body> -[JS Master's Road first part] JavaScript on hundreds of actual combat "new" _3 JavaScript variable type