This is literally the first time I've attempted coding - I don't even know if I will make any sense in my questions, please bear with me
Anyways, I've written a code that loops and displays an array.
Is it possible to change the colour of the text for each loop?
Thanks for the help everyone :)
<!DOCTYPE html>
<html>
<body>
<h2>Heroes & Their Ratings</h2>
<p><font color="red">This will display some superheroes and their respective ratings:</font></p>
<p id="demo"> </p>
<script> //Starts loop script
var heroes = ["Batman 3", "Superman 4", "Wonderwoman 7", "Flash 10", "Spiderman 17", "Green Lantern 18", "Bat Girl 28","Thor 23","Captain 30","Punisher 2", "Blink 1","Amber 5","Spawn 6","Dart 8", "Destiny 9","Iceman 11", "Magma 12","Dr. Fate 13","Grifter 15","Ice 14","Katana 16","KidFlash 19","Nite Owl 20","Red Arrow 21","Raven 22","V 25","Wildcat 24","Zan 25","TNT 26","Terra 27"]; //Array so heroes variable stores multiple names
var text= '';
var i = 0 //Assigns i a value of 0
for (; i < heroes.length; i++) { // loop runs for every superhero
text += heroes[i] + "<br>";
}
document.getElementById("demo").innerHTML = text;
//Ends loop script </script>
</body>
</html>
for (var i = 0; i < heroes.length; i++)