这样分配对象属性。怎么回事,我不明白(还)

时间:2019-12-28 22:43:09

标签: object

以下是MDN的代码段:

class Person {
      constructor(first, last, age, gender, interests) {
        this.name = {  //I don't understand these lines
          first,       //I don't understand these lines
          last         //I don't understand these lines
        };
        this.age = age;
        this.gender = gender;
        this.interests = interests;
      }

我理解这一点:

this.name = {  
   first: first,     
   last: last     
}

但不是第一个。有人可以对我解释一下吗?

0 个答案:

没有答案