跳到主要内容

类型检查

typeof 运算符

  • typeof用来检查不同的值的类型
  • 它会更具不同的值返回不同的结果
let a = 10;
let b = 10n;

console.log(typeof a); // number
console.log(typeof b); // bigint