Skip to content

Instantly share code, notes, and snippets.

@lspdv
Last active Sep 8, 2017
Embed
What would you like to do?
Given the following code, I understand what the output will be:
//Given the following code, I understand what the output will be
//Please answer fill only to the registration form for MSD Code Academy :-)
const obj = {
name: 'John',
getName () {
return this.name;
}
};
const name1 = obj.getName();
const getName = obj.getName;
const name2 = getName();
console.log(`${name1} ${name2}`);
//A: "John John"
//B: "null John"
//C: "John undefined"
//D: It will throw an error
//E: Have no idea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment