Tuesday, 1 October 2013

Scoping and 'this'

Scoping and 'this'

Background: I am primarily a ruby/rails developer. I've been using
JS/Backbone a lot recently, and I keep running in to scoping issues that I
generally flail around with until it magically works.
Can someone explain/tell me of a place that explains how scoping works in JS?
Additionally, I've run in to people using 'that = this' to get around
scoping issues. As I understand it, it makes the parent scope of whatever
you're in 'that', so that things that are in 'that' can be accessed in
deeper scopes?
I am confused.

No comments:

Post a Comment