Top "Scope" questions

Scope is an enclosing context where values and expressions are associated.

Is it possible to declare two variables of different types in a for loop?

Is it possible to declare two variables of different types in the initialization body of a for loop in C++? …

c++ scope declaration for-loop
Limiting number of displayed results when using ngRepeat

I find the AngularJS tutorials hard to understand; this one is walking me through building an app that displays phones. …

javascript model-view-controller angularjs scope
Underscore prefix for property and method names in JavaScript

Is the underscore prefix in JavaScript only a convention, like for example in Python private class methods are? From the 2.7 …

javascript scope naming-conventions
A variable modified inside a while loop is not remembered

In the following program, if I set the variable $foo to the value 1 inside the first if statement, it works …

bash while-loop scope sh
Passing a variable from one php include file to another: global vs. not

I'm trying to pass a variable from one include file to another. This is NOT working unless I declare the …

php variables include scope global
Why Is `Export Default Const` invalid?

I see that the following is fine: const Tab = connect( mapState, mapDispatch )( Tabs ); export default Tab; However, this is incorrect: …

javascript scope export constants default
How do I pass the this context to a function?

I thought this would be something I could easily google, but maybe I'm not asking the right question... How do …

javascript jquery scope this
What underlies this JavaScript idiom: var self = this?

I saw the following in the source for WebKit HTML 5 SQL Storage Notes Demo: function Note() { var self = this; var …

javascript scope closures
Static variables in C++

I would like to know what is the difference between static variables in a header file vs declared in a …

c++ static scope
Nested classes' scope?

I'm trying to understand scope in nested classes in Python. Here is my example code: class OuterClass: outer_var = 1 class …

python class scope nested inner-classes