es6对象简写

时间:2021-09-01 21:58:12   收藏:0   阅读:9

1如果key和变量的名字一致,可以指定义一次即可

2如果value是一个函数,可以把:funtion去掉 只剩()即可

let info={
    title:"0",
    link:"1"
    ,go:function (){
        console.log("2");
    }
}

var title="0";
var link="1";
let info1 ={
    title,
    link,
    go(){
        console.log("2");
    }
}

  

$("#loginbtn").on("click",function (){
    var  account=$("#account").val();
    var  password=$("#password").val();
    var  param={account,password}
    $.ajax({
        type:‘post‘,
        url:"",
        data:{account:account,password:password},
        /*param*/
        success() {

        },
        success:function (){
            
        }
    })
})

  

原文:https://www.cnblogs.com/huluxia-fun/p/15213370.html

评论(0)
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!