According to the Google JavaScript style guide, function declarations should not be declared within blocks since this is not a part of ECMAScript. However, I'm not entirely clear on what counts as a block.
Specifically, I have a constructor function and I want to define a function within the scope of that constructor. Would this count as a function within a block, since it is within a set of {}? If so, does that mean every function declaration must be global?
Some code for good measure:
WRONG (?)
function Constructor() {
function Shout () { alert('THE BEST UX IS IN ALL CAPS.'); }
}
RIGHT (?)
function Constructor() {
var Shout = function () { alert('THE BEST UX IS IN ALL CAPS.'); };
}