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

20-2-结构赋值

时间:2019-09-07 13:03:25      阅读:87      评论:0      收藏:0      [点我收藏+]

标签:meta   es6   padding   nbsp   tle   none   let   mil   i++   

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body {
            font-family: "Microsoft YaHei", serif;
        }

        body, dl, dd, p, h1, h2, h3, h4, h5, h6 {
            margin: 0;
        }

        ol, ul, li {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        img {
            border: none
        }
    </style>
</head>
<body>

<script>


//    //ES6定义变量的解构赋值
//
//    let a = 10-vue-router,
//        b = 20,
//        c = 30;
//
//
//    // 这两个是一样的
//    let [d,e,f] = [10-vue-router,20,30];

    // function fn() {
    //     let x = [];
    //     for (let i=0;i<5;i++){
    //         x[i] = i*i;
    //     }
    //     return x;
    // }
    //
    // let [a,b,c,d,e,] = fn()

    // let {a:x,b:y} = {a:10-vue-router,b:20};
    // console.log(x);
    // // x和y是变量名

    // let {x:x,y:y} = {a:10-vue-router,b:20};
    // console.log(x);
    // console.log(y);


    // let {x:a,y:b} = {y:10-vue-router,x:20};
    // console.log(a);
    // console.log(b);

    let {x,y} = {y:10,x:20};


</script>
</body>
</html>

 

20-2-结构赋值

标签:meta   es6   padding   nbsp   tle   none   let   mil   i++   

原文地址:https://www.cnblogs.com/zhangyu666/p/11480073.html

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