I'm just started with JavaScript and I have a little problem.
How do I use the innerHTML propriety to change the text in this element:
(function showArray(){
var names = new Array("Bob ","Alice ","Ceaser ","David");
names.sort();
for (var i = 0; i < names.length; i++) {
document.getElementById("loop").innerHTML = names[i];
// I'm only getting "David" as output!!
}
})();
<p id="loop">David Alice Bob Ceaser</p>
innerHTML =toinnerHTML +=.