Skip to content

Instantly share code, notes, and snippets.

@lspdv
Last active September 8, 2017 10:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lspdv/ef4a2bf20191580e0dc984b796317b8c to your computer and use it in GitHub Desktop.
Save lspdv/ef4a2bf20191580e0dc984b796317b8c to your computer and use it in GitHub Desktop.
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