Sometime you see that we need event
object in javascript.
Here is some code how can we pass event
.
function test(e){
console.log(e);
e.preventDefault();
console.log("you are not going to redirect");
}
HTML
<a href="www.google.com" onclick="test(event)">GOOGLE</a>
Just pass the event
in function argument if you want to pass event in function.