1234567891011121314151617181920212223242526272829303132333435363738 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <!--
- js数据类型
- 基本数据类型:
- null undefined string boolean number
- 引用数据类型
- object(object/array/function)
- -->
- <script>
- let obj = {
- name:'小明'
- }
- let arr = [1,2,3];
- function fn1() {
- return '你好'
- }
- // 1.typeof
- console.log(typeof arr)
- // 2.instanceof
- console.log(fn1 instanceof Function)
- // 3.Object.prototype.toString.call
- console.log(Object.prototype.toString.call(fn1));
- // 4.constructor
- console.log(false.constructor === Boolean)
- console.log(fn1.constructor === Boolean)
- // console.log(null.constructor === Null)
- // console.log(undefined.constructor === Undefined)
- </script>
- </body>
- </html>
|