Skip to content

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

Closed
ajpiano opened this issue Mar 16, 2012 · 8 comments
Closed

Expand javascript-101/scope #89

ajpiano opened this issue Mar 16, 2012 · 8 comments
Labels
Chapter: javascript-101 Removed, since https://github.com/jquery/learn.jquery.com/pull/622 content

Comments

@ajpiano
Copy link
Member

ajpiano commented Mar 16, 2012

Expand to expain call and apply, and explain them in the context that beginners are familiar with - the notion of this "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/or Function.prototype.bind to control the scope of a function later on, as well as the good old var that = this pattern.

@addyosmani
Copy link
Member

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 $.proxy, do you mean in another section or in JS101? I mentioned this in another issue but perhaps it would make sense to avoid jQuery examples here and cover those in follow up sections?.

@connor
Copy link
Contributor

connor commented Mar 28, 2012

@addyosmani I think we should avoid jQuery examples in JS101, thus moving $.proxy to a different section. I think it makes sense to keep JS101 and jQuery separate.

@ajpiano
Copy link
Member Author

ajpiano commented Apr 20, 2012

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 :)

@jackfranklin
Copy link
Contributor

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?

@adrocknaphobia
Copy link

@jackfranklin: Does your gracious offer still stand?

@jackfranklin
Copy link
Contributor

@adrocknaphobia wow, forgot about this! Yes it does :)

@ajpiano
Copy link
Member Author

ajpiano commented Nov 2, 2012

@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.

@scottgonzalez
Copy link
Member

This was addressed a year ago in 6fc9783.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Chapter: javascript-101 Removed, since https://github.com/jquery/learn.jquery.com/pull/622 content
Development

No branches or pull requests

6 participants