This commit is contained in:
asd
2021-06-03 10:52:41 +08:00
parent c5f18c6051
commit 907511778b
54 changed files with 3540 additions and 50 deletions

View File

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
// js 数据类型
// 基本数据类型 number string boolean undefined null
// 复杂数据类型: object
// var arr=new Array()
// var fn=new Function()
// 基本数据类型和复杂数据类型的区别
// 检测数据类型
// 由低到高 typeof instanceof Object.prototype.tostring.call
// typeof instanceof Object.prototype.toString.call
var a=9
var type=Object.prototype.toString.call(a)
console.log(Object.prototype.toString.call([1,2,3,4]))
console.log(Object.prototype.toString.call(9),"mmmn")
console.log(type)
console.log(9 instanceof Number)
console.log(new Number(9) instanceof Number)
console.log([1,2,3,4] instanceof Array)
console.log(function fn(){} instanceof Function)
// instanceof 用法 被检测的值 instanceof 猜测的数据类型
// 返回的是true/false
var key=123
console.log(typeof key)
console.log(typeof null)
console.log(typeof undefined)
console.log(typeof [4,3,1])
console.log(typeof function fm(){})
</script>
</head>
<body>
</body>
</html>