There is some javascript code, e.g.
function hello() {
}
function world() {
}
I want to add some logging code to them, but I don't want to modify the code. I hope I can write some code in another file, and it will modify the functions at runtime. It is possible to do this?
Update
Thanks for the two answers, but I have to make this question clearer.
The hello
and world
functions are just some samples, actually there are hundreds of functions in the file, it's implement to redefine them manually.
I'm looking for a way to do this automatically (similar to AspectJ in java).