Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // example demonstrating the scope of this inside an object
- myObject.mySum = function() {return this.a + this.b}
- myObject.mySum()
- >>150
- // another example
- myObject.newFunction = function() {console.log(this)}
- myObject.newFunction()
- >> {a: 100, b: 50, mySum: ƒ, newFunction: ƒ}
Add Comment
Please, Sign In to add comment