es6--对象简介语法

 

let name = "aaa";
        let age = 1;
        let add = function () {
            console.log('添加');
        }
        // let obj = {
        //     name: name,
        //     age: age,
        //     add: add
        // }

        let obj = {
            name,
            age,
            add,
            update: function () {
                console.log('添加1111');
            },

            cheng() {
                console.log('方法');
            }


        }
        obj.add();

 

posted @ 2020-07-14 19:09  jentary  阅读(103)  评论(0编辑  收藏  举报