12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <!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>
- </head>
- <body>
- <script>
- // var person = {
- // name: 'zs',
- // age: 18,
- // school: {
- // num: 10000,
- // name: 'qinghua'
- // }
- // }
- // console.log(person.age)
- var computer = new Object();
- //对象.属性名 = 属性值
- computer.cpu = 'i9-13'
- computer.xianka = '4090'
- computer.neicun = 'sanxing16G'
- console.log(computer)
- var person = new Array();
- person[0] = 18;
- person[1] = "123kg";
- person[2] = "170cm";
- person[3] = 2;
-
- console.log(person)
- console.log(typeof computer) //数组还是对象 数据类型都是object
- console.log(typeof person)
- var x = new String(); // 把 x 声明为 String 对象
- var y = new Number(); // 把 y 声明为 Number 对象
- var z = new Boolean(); // 把 z 声明为 Boolean 对象
- x = '123'
- // 请避免字符串、数值或逻辑对象。他们会增加代码的复杂性并降低执行速度
- </script>
- </body>
- </html>
|