-
Notifications
You must be signed in to change notification settings - Fork 480
Expand javascript-101/scope
#89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've reached out to Yehuda to see if he would be okay with us borrowing some of his content for this. Failing this, I know WebReflection and one or two others have also covered this topic before. When you say we should cover |
@addyosmani I think we should avoid jQuery examples in JS101, thus moving |
Scope and this in JavaScript by @jackfranklin has a lot of the nuts-and-bolts "how to deal with scope" content that I'd been envisioning for this article. Let's use it as a reference point or see if @jackfranklin is willing to contribute some of the content back here :) |
Hey @ajpiano thanks for the mention :) I'd be happy to contribute content from that article into the site. How best do you want to go about it? |
@jackfranklin: Does your gracious offer still stand? |
@adrocknaphobia wow, forgot about this! Yes it does :) |
@jackfranklin Awesome, sorry about the..... lull :) The best thing to do is just fork this repo and work your content into the existing scope article and file a pull request. I think this article is going to be a somewhat low-level, "Scope: What is This," and then we should have a separate article on scope manipulation, how you can do it, and how it happens a lot under the hood in jQuery. |
This was addressed a year ago in 6fc9783. |
Expand to expain
call
andapply
, and explain them in the context that beginners are familiar with - the notion ofthis
"changing" as you go from one section of code into an event handler . We should link to, if not borrow from, @wycats's Understanding JavaScript Function Invocation and “this”.We should also explain how to use
$.proxy
and/orFunction.prototype.bind
to control the scope of a function later on, as well as the good oldvar that = this
pattern.The text was updated successfully, but these errors were encountered: