<button onclick="changeElement()">Chnage Element</button>
<p id="demo"></p>
<script>
var courses = ["javascript", "php", "angularjs", "node js"];
document.getElementById("demo").innerHTML = courses;
function changeElement() {
courses[1]= 'Ajax';
document.getElementById("demo").innerHTML = courses;
}
</script>