assign a function to a global variable in javascript
<p>I have a function like this:-</p>

<pre><code>function test() {
    // code here
}
</code></pre>

<p>I want to assign the function <code>test()</code> to a global variable so that I should be able to call the function from elsewhere in the script using <code>window.newName()</code>. How can I assign this?</p>

<p>I tried <code>window.newName = test();</code>, but it didn't work. Please advice.</p>
