let greeting;
greetign = {}; // Typo!
console.log(greetign);
Choose 1 answer
Question 10 of 20
What happens when we do this?
function bark() {
console.log('Woof!');
}
bark.animal = 'dog';
Choose 1 answer
Question 11 of 20
What will be the output of this function?
function Person(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
const member = new Person('Lydia', 'Hallie');
Person.getFullName = function() {
return `${this.firstName} ${this.lastName}`;
};
console.log(member.getFullName());
Choose 1 answer
Question 12 of 20
What will be the output of the following code?
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);
Choose 1 answer
Question 13 of 20
What are the three phases of event propagation?
Choose 1 answer
Question 14 of 20
Do all objects have prototypes?
Choose 1 answer
Question 15 of 20
What's the output of the following code?
function sum(a, b) {
return a + b;
}
sum(1, '2');
Choose 1 answer
Question 16 of 20
What will be the output of this code?
let number = 0;
console.log(number++);
console.log(++number);
console.log(number);
Choose 1 answer
Question 17 of 20
What will be logged by the following code?
function getPersonInfo(one, two, three) {
console.log(one);
console.log(two);
console.log(three);
}
const person = 'Lydia';
const age = 21;
getPersonInfo`${person} is ${age} years old`;
Choose 1 answer
Question 18 of 20
What will be logged by this code?
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 });
Choose 1 answer
Question 19 of 20
What's the output of the following code?
function getAge(...args) {
console.log(typeof args);
}
getAge(21);
Choose 1 answer
Question 20 of 20
What's the output of the following code?
function getAge() {
'use strict';
age = 21;
console.log(age);
}
getAge();