0

let group = {
  title: "Our Group",
  showgroup: function() {
    var test = function() {
      console.log(this)
    }
    test();
  },
};

group.showgroup()
brk
  • 48,835
  • 10
  • 56
  • 78
rati_geo
  • 63
  • 5
  • You didn't create an instance here, just an object literal. For oop, use either of there: https://jsfiddle.net/khrismuc/6ocatj0v/ –  May 12 '20 at 08:37
  • Because the call that's responsible for determining the `this` context is `test();`, not `group.showgroup()` – Bergi May 12 '20 at 08:38

0 Answers0