I have a function like this:-
function test() {
// code here
}
I want to assign the function test() to a global variable so that I should be able to call the function from elsewhere in the script using window.newName(). How can I assign this?
I tried window.newName = test();, but it didn't work. Please advice.
window.newName = test;?