The most viewed items
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Code Testing</title>
</head>
<body>
<button id = "btn1">Try Now</button>
<p id = "demo1"></p>
<button id = "btn2">Try Now</button>
<p id = "demo2"></p>
<script>
var test1 = function(){
document.getElementById("demo1").innerHTML += this;
}
//window object calls the function
window.addEventListener("load", test1);
//button object calls the function
document.getElementById("btn1").addEventListener("click", test1);
var test2 = () =>{
document.getElementById("demo2").innerHTML += this;
}
//window object calls the function
window.addEventListener("load", test2);
//button object calls the function
document.getElementById("btn2").addEventListener("click", test2);
</script>
</body>
</html>
No comment to show.