请问ES6扩展对象有个小疑惑

为什么方法运行不是obj.add(),而是obj.plus,调用的方法名是值的名称,不是属性名?
    var username="zhangsan",age=78;
    const add="plus";
    var obj={
        username,
        age,
        [add]:function(){
            console.log("加法");
        }
    };
    obj.plus();
    obj.add();

let a = {
x:1,
y:2
}
a.x === a['x']

因为你下面方法名改成plus了

你的写法变成了es6中属性表达式,详情可参照阮一峰的这篇文章

https://www.bookstack.cn/read/es6-3rd/spilt.2.docs-object.md