JS查看数据类型

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			var num=1;
			//number
			console.log(typeof num);
			var boo=true;
			//boolean
			console.log(typeof boo);
			var str='hello word';
			//string
			console.log(typeof str);
			var und=undefined;
			//undefined
			console.log(typeof und);
			var nu=null;
			//object
			console.log(typeof nu);
		</script>
	</head>
	<body>
	</body>
</html>

猜你喜欢

转载自blog.csdn.net/qq_39706570/article/details/106756062