javascript数据类型

68 阅读1分钟

javascript数据类型

分为:基本(值)类型、对象(引用)类型两种

基本(值)类型

  • String: 值为任意字符串
  • Number: 值为任意的数字
  • boolean: 值为true/false
  • null: 值为null
  • undefined: 只为undefined

对象(引用)类型

  • Object: 值为任意对象
  • Function: 值为一种特别的对象(可以执行)
eg: function demo() {
    console.log(我是一种特别的对象) 
}
  • Araay: 值为一种特别的对象(数值下标,内部数据是有序的)
eg: const arr = [1, 2, 3]