关于javascript:选择篇022下面代码的输出是什么

44次阅读

共计 454 个字符,预计需要花费 2 分钟才能阅读完成。

function Person(firstName, lastName) {
  this.firstName = firstName
  this.lastName = lastName
}

const lydia = new Person('Lydia', 'Hallie')
const sarah = Person('Sarah', 'Smith')

console.log(lydia)
console.log(sarah)

A: Person {firstName:“Lydia”, lastName:“Hallie”} and undefined
B: Person {firstName:“Lydia”, lastName:“Hallie”} and Person {firstName:“Sarah”, lastName:“Smith”}
C: Person {firstName:“Lydia”, lastName:“Hallie”} and {}
D:Person {firstName:“Lydia”, lastName:“Hallie”} and ReferenceError

参考答案:

正文完
 0