How to do function override in JavaScript ?
I have below code.
function helloWorld () {
return 'helloworld ';
}
var origHelloWorld = window.helloWorld;
window.helloWorld = function() {
return 'helloworld2';
}
alert(helloWorld);
I would like to get output like
helloworld helloworld2
What should I do ?
May be I described less. Actually I would like to call function the helloworld
and I would like to get output of both functions jointly.