I am new to js and not able to understand which this does not points to the "obj" in the below code: var obj = { x:this }; obj.x; // window object
I have referred many sites but all states the this always points to the object in whose context the method was called..does that not hold true for property??
Also why this pointing becomes correct inside a function as property of same object?? I have read that scope and context are not to be confused are different, then why only function is creating right context??I read that scope are of two type local and global then why context is affected.
Please explain in details, this question might be irrelevant maybe because i am still confused in scope and context..shares useful links too.