Typescript中类型判断

function typejudge(params: number) {
    return params;
}
console.log(typeof 1);// number
console.log(typeof "Hello,world!"); // string
console.log(typeof ([0, 1, 2]));
console.log(typeof ([0, "Hello,world"]));
console.log(typeof typejudge);

相关推荐