SOURCE

function getType(val) {
    if (val === null) {
        return "null";
    }
    if (typeof val === "object") {
        const type = Object.prototype.toString.call(val).slice(8, -1)
        return type;
    } else {
        return typeof val + "";
    }
}

console.log(getType({ a: 1 }));

console 命令行工具 X clear

                    
>
console