I'm new to JavaScript so I apologize if it's too dumb question.I don't understand how this keyword behaves in examples below.
In first case, this refers to window object:
Element.prototype.x = this;
some_element.x; // Returns window object.
And in second, it refers to DOM Element:
Element.prototype.x = function(){return this;};
some_element.x(); // Returns element itself.
Why? How do those examples differ?
 
    