document.querySelector('html').onclick = function() {
alert('Ouch! Stop poking me!');
}
Events are things browser or user do it like click,scroll,press keyboard.
const button =document.querySelector('#submit)
//Click,Scroll,Resizing the browser
button.addEventListener('click', function(){
console.log('New Item added'); //when button with id #submit click it console.log
})
//this is an event detector for a mouseclick with Jquery
$('#id').on('click',function(){
yourFunction(args);
});
<!DOCTYPE html>
<html>
<body>
<h1 onclick="this.innerHTML = 'Ooops!'">Click on this text!</h1>
</body>
</html>
let array_1 = [1, 2, 3, 4, 5, 6];