SOURCE

(function(){
    //类型检查
    let num = 1;
    let str = '1';
    let nul = null;
    let unde = undefined;
    let array = [];
    let mp = {};
    let func = function(){};
    
    function baseType(){
        console.log(typeof num)
        console.log(typeof str)
        console.log(typeof nul)
        console.log(typeof unde)
        console.log(typeof array)
        console.log(typeof mp)
        console.log(typeof func)
    }
    baseType();
    function maptype(){
        console.log(num instanceof Number)
        console.log(str instanceof String)
        console.log(nul instanceof Object)
        console.log(unde instanceof Object)
        console.log(array instanceof Array)
        console.log(mp instanceof Object)
        console.log(func instanceof Function) //Object
    }
    maptype();
    function proType(){
        console.log(Object.prototype.toString.call(num))
        console.log(Object.prototype.toString.call(str))
        console.log(Object.prototype.toString.call(nul))
        console.log(Object.prototype.toString.call(unde))
        console.log(Object.prototype.toString.call(array))
        console.log(Object.prototype.toString.call(mp))
        console.log(Object.prototype.toString.call(func))
    }
    proType();
})()
console 命令行工具 X clear

                    
>
console