JS 数据类型

作者: roy_pub | 来源:发表于2019-11-20 18:06 被阅读0次

    JS 基本数据类型

    • boolean
    let c = true
    console.log(typeof c) //boolean
    
    • number
    let a = 123
    console.log(typeof a) //number
    
    • string
    let a = '123'
    console.log(typeof a ) //string
    
    • undefined
    let a
    console.log(typeof a) //undefined
    console.log(typeof b) //undefined
    
    • null
    let a = null
    console.log(typeof a) //object
    
    • symbol
    let a = Symbol()
    console.log(typeof a) //symbol
    

    JS 复杂数据类型

    • object
    let a = {name: 'roy'}
    console.log(typeof(a)) //object
    
    let a = ['apple']
    console.log(typeof a) //object
    

    相关文章

      网友评论

        本文标题:JS 数据类型

        本文链接:https://www.haomeiwen.com/subject/rlqaictx.html