📜  检查javascript代码示例中的数据类型

📅  最后修改于: 2022-03-11 15:04:32.395000             🧑  作者: Mango

代码示例6
let counter = 120; // counter is a number
console.log(typeof(counter)); // "number"

counter = false;   // counter is now a boolean
console.log(typeof(counter)); // "boolean"

counter = "Hi";   // counter is now a string
console.log(typeof(counter)); // "string"Code language: JavaScript (javascript)