javascript: overriding (not just defining) a function in if statement
<p>I have the following javascript.</p>

<pre><code>var f = function() { ... };
if (x === 1) {
    // redefine f.
    f = function() { 
       ...
    };
}
</code></pre>

<p>Is that code valid ? 
In other words can I redefine a javascript function inside an if statement where I actually write the code. </p>

<p>I am worried because of this:
<a href="http://stackoverflow.com/questions/10069204/function-declarations-inside-if-else-statements">Function declarations inside if/else statements?</a></p>
