0

Need to build MVC shape

The user enters his name, you need to display each letter of his name in the console, starting with the last. help solve the problem, otherwise it does not come to mind how to do it let userName = prompt ('enter your user name'); let test = []; for(var i = 0; i < userName.length; i++) { test.push(userName[i]) } console.log(test.reverse('')) Of course, I'm not sure yet if I wrote everything correctly, since I am a beginner and I also lack practice.

1st Aug 2020, 8:10 AM
FishMan FishMAn
FishMan FishMAn - avatar
2 Antworten
+ 4
FishMan FishMAn , yes your code works. You can achieve it also this way after the first line: userName.split("").reverse("").forEach(letter => console.log(letter));
1st Aug 2020, 8:30 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
I can't figure out how to write an mvc template. You can help?
1st Aug 2020, 10:36 AM
FishMan FishMAn
FishMan FishMAn - avatar