+ 2

Guys i want to change the value of the Array with in another Array type from Loop how can i do it .

Answer is coming only Ethan and another is Undefined. https://code.sololearn.com/WCzIKtCjvSS5/?ref=app

31st Mar 2018, 2:35 PM
🦋FEATHER🦋
🦋FEATHER🦋 - avatar
6 ответов
+ 2
I suggest using document.getElementsByTagName instead of what you used.
31st Mar 2018, 3:46 PM
Tomer Sim
Tomer Sim - avatar
+ 1
your div has more than 2 childs, 3 of them are texts, and 2 of them are p tags you can check which of them are p tag using .nodeName
31st Mar 2018, 4:18 PM
🇮🇷 M N
+ 1
use this code: var i = 0; for(var x=0;x<arr.length;x++) { if(arr[x].nodeName=="P") { arr[x].innerHTML = name[i++]; } }
31st Mar 2018, 4:46 PM
🇮🇷 M N
+ 1
@M N it is still not working can you correct it in my code and please comment out were the mistake i did.
1st Apr 2018, 2:33 AM
🦋FEATHER🦋
🦋FEATHER🦋 - avatar
+ 1
you have 2 mistake: 1. the "P" must be capital not "p" 2. the c++ must be in if, so whenever tag is P then element c of name array sets to innerHtml and c inrease to refer to next element in name array
1st Apr 2018, 5:48 AM
🇮🇷 M N
1st Apr 2018, 5:50 AM
🇮🇷 M N