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)
【选择篇(022)-下面代码的输出是什么?】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到1搭建组件库
- JS中 &&、|| 和 & 、| 的使用
- Mac 上制作 SSL 证书
- JavaScript 基本数据类型转换
- 微信商城小程序开发方式有哪些()
- Form 表单在数栈的应用(下)(深入篇)
- 选择篇(019)-下面代码的输出是什么?
- 选择篇(020)-下面代码的输出是什么?
- 选择篇(018)-下面代码的输出是什么?