Based on the answer that @Mukund Kumar gave here's a version that passes the event argument to the anonymous function:
<a href="#" onClick="(function(e){
console.log(e);
alert('Hey i am calling');
return false;
})(arguments[0]);return false;">click here</a>