News for hackers. Stuff that matters.
Re:Are JavaScript Linters the Answer? by paultannenbaum on Thursday April 17, 2014 @03:09AM (#7602328)
I stand corrected on not being able to attach properties to a function, but what I said still holds true. The keyword this refers to the object that owns the method. The original commenter was saying that it was the method itself that was what this points at.

letsdrive = myRide.drive window.model = 'mercedes'; letsdrive.model = 'bmw';

letsdrive(); // outputs mercedes

There are no comments on this comment yet.