What is the difference between the whatever() and best_quote() functions in the following code?

function whatever() {
  return "talk to the hand";

var clueless = {
  best_quote: function() { return "That’s Ren and Stimpy. They’re way existential." }


whatever() is a function in the global namespace. best_quote() is a property of the clueless object, so it is a special type of function called a method. When whatever() and best_quote() are invoked, they are said to have different invocation contexts because they are called in different ways. whatever() is invoked as a function and best_quote() is invoked as a method.


© 2017