I came across following scenario:
When I call function normally it can access contextObj
contextObj = {a: 22, b:55}
function user(){ console.log(this.contextObj.a)}
user()
output = 22
but if I try following it gives me error undefined
contextObj = {a: 22, b:55}
function user(){ console.log(this.contextObj.a)}
let obj = new user()
Can someone help me understand 'this'? is it because of keyword new
Thanks in advance :)