js中的五种基本数据类型

165 阅读1分钟

五种基本数据类型

1.string类型

//1. string类型 : 字符串 一切以  单引号''  双引号""  反引号``包起来的内容
    //作用 : 用于展示文本
​
    console.log('我是最靓的仔')
    console.log('我 "和" 你');

2.number类型

//2. number类型 : 数值 一切数学中的数字。
    //作用 : 用于数学计算
    console.log(120);

3.boolean类型

//3. boolean类型 : 布尔 只有两个值 :  true(真)  false(假)
    //作用 : 用于条件判断  true:条件成立  false:条件不成立
    console.log(true);

4.undefined类型

//4. undefined : 未定义  只有一个值 undefined
    console.log(undefined);

5.null类型

//5. null : 空值  只有一个值 null
    console.log( null )