Array loop

by anoopsuda

JavaScript

const myAlps = ["A","B", "C", "D"];
let count = myAlps.length;
let alps = "";
for (let i = 0; i < count; i++ ){
alps  += myAlps[i] + "<br>";
}
document.write(alps);

myAlps.forEach((item, index,array) =>{console.log(item, index)} ) 
myAlps.forEach((item,index) => {document.write(item, index)} )