码迷,mamicode.com
首页 > 其他好文 > 详细

简单的解构赋值

时间:2018-12-29 13:36:23      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:ini   ack   port   scale   round   contex   htm   script   state   

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script>
    // const arr = [1,2,3,4]
    /* const a = 1
    const b = 2
    const c = 3
    const d = 4 */

    // const [a, c, b, d] = [1, 2, 3, 4]

    // const age = 20

    function fn(callback) {
      callback({a: 10, b: 20})
    }

    fn(function ({a, b}) {
      console.log(a, b)
    })


    // const {a, b} = {a: 10, b: 20}

    function fn (context) {}
    fn ({commit})
    // content = store = {commit: function () {}, state: {}}
    const {commit, state} = context
    const {age: age1, name} = {name: 张三, age: 18, sex: }



  </script>

</body>
</html>

 

简单的解构赋值

标签:ini   ack   port   scale   round   contex   htm   script   state   

原文地址:https://www.cnblogs.com/bao2333/p/10195210.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!