Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 1
    I think this guide (pun intended) might be useful to use as a kind of reference for what the this keyword is defined as in different situations. Really getting familiar with it, as with all other coding habits, just means that you just need to use it often enough though :P Commented Jan 9, 2014 at 17:56
  • ha! hence why I'm trying to use it here ;) Commented Jan 9, 2014 at 17:57
  • @Andy Oh by the way, in this particular situation, you could also add return color; to your function, and omit the new keyword. Then you can just get the color by just using the variable res. Commented Jan 10, 2014 at 17:13