JavaScript has data types, which are: 1. Primitive data types, object, number, string, boolean, null and undefined; 2. Reference data types, Array, Date and function of object type.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
Javascript's data types are divided into two categories: original data types and reference data types
Original data type:
Object
## NumberString
# Boolean
NULL
## Undefined## 引 The data type:
Object type Array, Date, Function
js variables
[1] Declaration of variables in js
v variable name = value;
## [2] The use of variables in js pay attention to pay attention to The names of the variables in # A, JS are consistent with the naming of Java's bidders. B, JS variable names can be repeated, but the name of the latter will cover the name of the former # C and JS. It is not recommended that you write this way. Commonly used type detection methods are: typeof, instanceof Liezi:var age = 13; alert(typeof(age)); //浏览器弹框内容:number var name = '五宝'; alert(typeof(age)); //浏览器弹框内容:string 注意,JavaScript没有char类型
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script> var a =1; var b =null; var c ="你好"; var d=true; var e=new Date(); var f='5'; var z=1.32; var a=123; alert(typeof(e)); //浏览器弹框出现 object </script> </head> <body> </body> </html>
javascript advanced tutorial]
The above is the detailed content of Does javascript have data types?. For more information, please follow other related articles on the PHP Chinese website!