Javascript use of “this” in OOP

I’ve been using javascript more seriously for the past 2 or 3 years, and today i decided to write on one of the most common pitfalls when trying to OOP in javascript, scope

using this can be really tricky, lets consider the following example

once you have run this ill explain it a little bit further:

the solution here is to pass reference to the parent object on the calling function