Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
58 views

When should javascript files be loaded

I am using a great deal of jquery. I have several "sub-pages" that are loaded into a main div by a menu click. Each of those sub pages has an associated javascript file. I have been loading the ...
Dave Davis's user avatar
9 votes
2 answers
4k views

Is `this` in JavaScript an example of dynamic scoping?

Variables in JavaScript are lexically scoped. But, I wonder, is the this keyword, referring to the receiver of a method, an example of dynamic scoping. Or is this unrelated to the lexical/dynamic ...
user1283776's user avatar
1 vote
5 answers
4k views

Where to declare a variable and define a function in Javascript?

I'm reading the book JavaScript: The Good Parts. On page 113 it recommends function expressions instead of function statements, because statements are subject to hoisting: The statement: function ...
ChrisW's user avatar
  • 3,427
43 votes
6 answers
14k views

Should I place functions that are only used in one other function, within that function?

Specifically, I'm writing in JavaScript. Let's say my primary function is Function A. If Function A makes several calls to Function B, but Function B is not used anywhere else, then should I just ...
Gary's user avatar
  • 533
7 votes
3 answers
4k views

Event-driven vs. 'reference'-driven programming (i.e. in JavaScript)

I haven't been able to find the appropriate terminology to search for content on the web related to what I'm asking, so I'm hoping someone on here can at least point me in the right direction. I'm a ...
Dan's user avatar
  • 207
0 votes
1 answer
1k views

Is there any way to limit the scope of a knockout.js application? [closed]

I have a legacy project which I have been approved to work in a knockout.js module. This is great, however the application is extremely complex and I need to use some of the pre-built form validation ...
bluetoft's user avatar
  • 111
5 votes
3 answers
291 views

Misunderstanding Scope in JavaScript?

I've seen a few other developers talk about binding scope in JavaScript but it has always seemed to me like this is an inaccurate phrase. The Function.prototype.call and Function.prototype.apply don't ...
Jeff's user avatar
  • 327