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>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章