This is rather a strange question but it is a requirement in my project. I want to override the function keyword in javaScript. The need is pretty complex but to make it simpler, as soon as I call a function, a console.log
must be fired. i.e.
let myfn = function(x,y) {
return x+y;
}
Now when I call myfn(5,7)
it should show
function called
Now, this console must alway show on every function call in my entire project. So I want to centralize this by overriding the default function in JS. Is this possible? If so how?
Thanks in advance!!