I have the following code:
<a href='#' class='link'>Click Me</a>
<script type="text/javascript">
$(".link").on('click', function(){
event.preventDefault();
console.log('This will appear on Chrome, but not in Firefox');
});
</script>
obviously there is an error in the code, because I dont have the 'event' variable in the function argument. Surprisingly the Chrome console will not report any error and will execute the console.log line. In case of Firefox, it will throw the following error: "ReferenceError: event is not defined" and will stop the code execution.
Why Chrome browser didn't report any error ? Are there any other exceptions in which the Chrome will ignore obviously buggy code ?
jsfiddle: https://jsfiddle.net/ArturoO/L3hym4r2/3/ Thanks in advance !