[Solved] How do I print a list of elements in array in JavaScript?


Here you are:

var array = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
for (var i = 0; i < array.length; i++) {
  var str="";
  for (var j = 0; j <= i; j++) {
    if (array[j] == 'E') str += '3';
    else str += array[j];
  }
  document.querySelector('span').innerHTML = document.querySelector('span').innerHTML + str + '<br />';
}
<span></span>

Hope this helps.

9

solved How do I print a list of elements in array in JavaScript?