Java script Print array

Hi!
im working on the wikpedia viewer for Free Code Camp .And im looking for a nice way to display my Array data in a column:i tried to print them one by one but it takes to long .im looking for smth much simpler
Thank u :smiley:D

Hi,

Not sure if understood correctly what you mean, But if you have a array with results you can iterate through it and append the results into a class. Something like this maybe, in shorthand.

html=””;
for (var i=0; i<arr.length; i++){
	html =’<div class=”result”>+arr[i]+</div>’;
	//append html  to β€˜main(container)’ class
}

thanks but i did smth else
for(var i=0;i<data[1].length;i++){
$(’#output’).prepend("

  • "+data[1][i]+"
  • ");
    }
    1 Like