typeof能判斷哪些類型

// 判斷全部值類型
        let a;                   typeof a //'undefined'
        const str='abc';         typeof str//'string'
        const n=100;             typeof n //'number'
        const b=true;            typeof b //'boolen'
        const s=Symbol('s');     typeof s //'symbol'
        // 能判斷函數
        typeof console.log                //'funcction'
        typeof function(){}                //'funcction'
        // 能識別引用類型(不能再繼續識別)
        typeof null          //'object'
        typeof ['s','b']      //'object'
        typeof {x:100}       //'object'
相關文章
相關標籤/搜索