0

Need help with JAVASCRIPT DOM Quiz!

This below quiz is from changing elements. What is the array number? And how to find it? var s = document. getElementsByTagName("span"); for(var x=0; x<s.length;x++) { s[ ].style.backgroundColor = "#33EA73"; }

6th May 2018, 12:04 AM
Hussain Mohammed
Hussain Mohammed - avatar
2 odpowiedzi
+ 2
x. s contains an array of span elements. you are looping from 0 until the last index of the array and storing that in x. so s[x]. style.etc is what you want.
6th May 2018, 12:11 AM
Adam
Adam - avatar
+ 1
Thanks!
6th May 2018, 12:13 AM
Hussain Mohammed
Hussain Mohammed - avatar