JavaScript学习笔记—类型检查
typeof运算符
- typeof用来检查不同的值的类型
- 它会根据不同的值返回不同的结果
let a = 10;
let b = 10n;
console.log(typeof n); // number
console.log(typeof b); // bigint
typeof运算符
- typeof用来检查不同的值的类型
- 它会根据不同的值返回不同的结果
let a = 10;
let b = 10n;
console.log(typeof n); // number
console.log(typeof b); // bigint