Please consider the official ECMAScript specification as the source for your answer, and not a document published by a specific browser vendor. (I am aware of Mozilla extend
Yes it is valid.
All statement blocks (i.e everything within curly braces) can have additional statements and declarations, including functions.
So you can also define functions within functions and so on
Here is ECMA-262 v1 - http://www.mozilla.org/js/language/E262.pdf