单项选择题
下面代码的输出是什么?()
function checkAge(data) {
if (data === { age: 18 }) {
console.log("You are an adult!");
} else if (data == { age: 18 }) {
console.log("You are still an adult.");
} else {
console.log(`Hmm.. You don't have an age I guess`);
}
}
checkAge({ age: 18 });
A.You are anadult!
B.You are still an adult.
C.Hmm..You don’t have an age I guess
相关考题
-
单项选择题
下面代码的输出是什么?() let number = 0; console.log(number++); console.log(++number); console.log(number);
A.1 1 2
B.1 2 2
C.0 2 2
D.0 1 2 -
单项选择题
下面代码的输出是什么?() function sum(a, b) { return a + b; } sum(1, "2");
A.NaN
B.TypeError
C."12"
D.3 -
单项选择题
下面代码的输出是什么?() 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
