Question:

Demonstrate that the this keyword refers to the object itself for functions that are invoked in the method invocation context.

Answer:

var cup = {
  something: function() {
    return this === cup;
  }
}
console.log(cup.something());  // prints "true" to the console

Keywords:

© 2017 QuizBucket.org