|
@@ -0,0 +1,58 @@
|
|
|
+<!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>
|
|
|
+ <script>
|
|
|
+ var arr = [1,2,3];
|
|
|
+ var [a,b,c] = [1,2,3];
|
|
|
+ console.log(a,'a');
|
|
|
+ console.log(b,'b');
|
|
|
+ console.log(c,'c');
|
|
|
+
|
|
|
+ var str = 'vase';
|
|
|
+ var [x,y,z,e] = str;
|
|
|
+ console.log(x,'x');
|
|
|
+ console.log(y,'y');
|
|
|
+ console.log(z,'z');
|
|
|
+ console.log(e,'e');
|
|
|
+
|
|
|
+ var obj = {
|
|
|
+ name: 'Lucy',
|
|
|
+ age: 18,
|
|
|
+ address:function() {
|
|
|
+ console.log("我的地址")
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var {name,age,address} = obj;
|
|
|
+ // obj.address();
|
|
|
+ console.log(name);
|
|
|
+ console.log(age);
|
|
|
+ console.log(address);
|
|
|
+
|
|
|
+ // 形参
|
|
|
+ function fn1(name1,age1) {
|
|
|
+ console.log(name1,'函数1');
|
|
|
+ console.log(age1,'函数2')
|
|
|
+ }
|
|
|
+ // 实参
|
|
|
+ fn1({name1:'LiLi'},{age1:20});
|
|
|
+
|
|
|
+
|
|
|
+ function fn2() {
|
|
|
+ return {
|
|
|
+ name2:'小明',
|
|
|
+ age2: 23
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var {name2,age2} = fn2();
|
|
|
+ console.log(name2,'name2');
|
|
|
+ console.log(age2,'age2');
|
|
|
+
|
|
|
+ </script>
|
|
|
+</body>
|
|
|
+</html>
|