|
@@ -0,0 +1,49 @@
|
|
|
+<!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 arr = [1,2,3]
|
|
|
+ console.log(arr)
|
|
|
+ var [a,b,c] = [4,5,6]
|
|
|
+ console.log(a,b,c)
|
|
|
+
|
|
|
+
|
|
|
+ var obj = {
|
|
|
+ name:'zs',
|
|
|
+ age:18,
|
|
|
+ eat:function(){
|
|
|
+ console.log('吃')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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 {age} = fn2()
|
|
|
+ console.log({age})
|
|
|
+ </script>
|
|
|
+</body>
|
|
|
+</html>
|