<!DOCTYPE html>
<html>
<body>
<p>In this code we will see how to push an element to array</p>
<button onclick="pushElementToArray()" id="btnClick">Click</button>
<p id="pId"></p>
<script>
var days = ["Sunday", "Monday", "Tuesday", "Wednsday"];
document.getElementById("pId").innerHTML = days;
function pushElementToArray() {
days.push("Saturday");
document.getElementById("pId").innerHTML = days;
}
</script>
</body>
</html>