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.
8/1/2020 8:10:47 AM
FishMan FishMAn2 Answers
New AnswerFishMan FishMAn , yes your code works. You can achieve it also this way after the first line: userName.split("").reverse("").forEach(letter => console.log(letter));
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message