javascript-this Flashcards
1
Q
What is this in JavaScript?
A
2
Q
What does it mean to say that this is an “implicit parameter”?
A
3
Q
When is the value of this determined in a function; call time or definition time?
A
4
Q
What does this refer to in the following code snippet?
var character = {
firstName: ‘Mario’,
greet: function () {
var message = ‘It's-a-me, ‘ + this.firstName + ‘!’;
console.log(message);
}
};
A
5
Q
Given the above character obj,
what is the result of the following code snippet? Why?
character.greet();
A
6
Q
Given the above character obj, what is the result of the following code snippet? Why?
var hello = character.greet;
hello();
A
7
Q
How can you tell what the value of this will be for a particular function or method definition?
A