0
Why I'm I having eay only instead of it reversing and adding ay to it
3 Antworten
+ 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)
}
+ 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
0
place document.write(new_text) inside the loop block