选择题1531/1620输出什么?

1class Person { 2 constructor() { 3 this.name = "Lydia" 4 } 5} 6 7Person = class AnotherPerson { 8 constructor() { 9 this.name = "Sarah" 10 } 11} 12 13const member = new Person() 14console.log(member.name)
难度:
2021-07-02 创建

本题为"单选题"

参考答案:

正确选项:B:"Sarah"

我们可以将类设置为等于其他类/函数构造函数。 在这种情况下,我们将Person设置为AnotherPerson。 这个构造函数的名字是Sarah,所以新的Person实例member上的name属性是Sarah

最近更新时间:2021-07-03

赞赏支持

题库维护不易,您的支持就是我们最大的动力!