JavaScript variables have 9 types: 1. string type; 2. number type; 3. boolean type; 4. null type; 5. undefined type; 6. Object type; 7. Array type; 8. Function type; 9. Symbol type.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
Value type: string, number, boolean, null, undefined
// 值类型:Number、string、bollean、undefined var a = 100 var b = a a = 200 console.log(b) // 100 // 引用类型:对象、数组、函数、null(空指针) // 可以扩展属性 var a = {age:20} var b = a b.age = 21 console.log(a.age) // 21 typeof undefined // undefined typeof 'abc' // string typeof 123 // number typeof true // boolean // typeof 区分不出来引用类型(除了函数) typeof {} // object typeof [] // object typeof null // object typeof console.log //function
javascript advanced tutorial】
The above is the detailed content of There are several types of JavaScript variables. For more information, please follow other related articles on the PHP Chinese website!