0

Why I'm I having eay only instead of it reversing and adding ay to it

https://code.sololearn.com/WvGGp3mKzTne/?ref=app

9th Jul 2021, 12:42 PM
Olorunsogo Abiodun Isaac
Olorunsogo Abiodun Isaac - avatar
3 Respuestas
+ 3
var text = "never mind any one of them" var text_split = text.split(" ") for(a = text_split.length-1; a>=0 ; a--){ new_text = ""; new_text += text_split[a ]+ "ay "; //continue; document.write(new_text) }
9th Jul 2021, 1:41 PM
Apongpoh Gilbert
Apongpoh Gilbert - avatar
+ 1
<!DOCTYPE HTML> <body> <s type="text/javascript" charset="utf-8"> var text="never mind any one of them" var text_split=text.split(" ") var new_text =""; for(a=text_split.length-1;a>=0;a--){ // new_text=""; it resets in every iteration, take it out. //you have to use text_split array instead of text. new_text+=(text_split[a]+"ay "); //continue; } document.write(new_text) </s> </body> //Note: it won't allow to add script tag in post so I edit to s, reedit to script
9th Jul 2021, 1:16 PM
Jayakrishna 🇮🇳
0
place document.write(new_text) inside the loop block
9th Jul 2021, 1:44 PM
Apongpoh Gilbert
Apongpoh Gilbert - avatar