In this example, "this" is the person object (The person object is the "owner" of the function), so it refers to the person object.
var person = {
  firstName  : "John",
  lastName   : "Doe",
  id         : 5566,
  myFunction : function() {
    return this; // [object Object]
    return this.firstName + " " + this.lastName; // John Doe
  }
};
by Luka Tatarishvili
4 years ago
JavaScript
objects
0
Pro tip: use ```triple backticks around text``` to write in code fences