I am not able to understand the parameter 'e' which is passed to prevent the Default Action in JavaScript
document.getElementById('submit').addEventListener('click', calculate, false);
function calculate(e){
e.preventDefault():
}
I am not able to understand the parameter 'e' which is passed to prevent the Default Action in JavaScript
document.getElementById('submit').addEventListener('click', calculate, false);
function calculate(e){
e.preventDefault():
}
The e in e.preventDefault prevents the default action when a link is clicked, which is the page refreshing or changing. So it allows for behavior such as clicking on a link making a call to the database without a page refresh.
Here is a guide on the topic: