|
@@ -0,0 +1,53 @@
|
|
|
+<!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 a = [1,2,3]
|
|
|
+ // console.log(a)
|
|
|
+
|
|
|
+
|
|
|
+ // var [b,c,d] = [1,2,3]
|
|
|
+ // console.log(b,c,d)
|
|
|
+
|
|
|
+
|
|
|
+ // var obj = {
|
|
|
+ // name:'zs',
|
|
|
+ // age: 18,
|
|
|
+ // eat : function(){
|
|
|
+ // console.log('eat')
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // var {age,name,eat} = obj
|
|
|
+ // console.log(age,name,eat)
|
|
|
+
|
|
|
+ // var str = 'ab'
|
|
|
+ // var [x,y,z] = str
|
|
|
+ // console.log(x,y,z)
|
|
|
+ // console.log(x)
|
|
|
+ // console.log(y)
|
|
|
+ // console.log(z)
|
|
|
+
|
|
|
+
|
|
|
+ // function fn(name,age){
|
|
|
+ // console.log(name,age)
|
|
|
+ // }
|
|
|
+ // fn({name:'zs',age:20})
|
|
|
+
|
|
|
+ function fn2(){
|
|
|
+ return{
|
|
|
+ name:'zs',
|
|
|
+ age: 18
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var {name} = fn2()
|
|
|
+ console.log(name)
|
|
|
+ </script>
|
|
|
+</body>
|
|
|
+</html>
|