<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script>
// Number
var num = 20;
console.log(typeof num); // 'number'
// Boolean
var bool = true;
console.log(typeof bool); // 'boolean'
// String
var str = 'Hello World!';
console.log(typeof str); // 'string'
// Null
var nul = null;
console.log(typeof nul); // 'object'
// Undefined
var undef = undefined;
console.log(typeof undef); // 'undefined'
</script>
</body>
</html>
JS-面向对象编程-检测基本数据或原始数据的类型
最新推荐文章于 2024-02-11 17:43:12 发布