If I’m correct, isn’t reverse() not allowed to be used in this challenge?
You can spli() and reverse with a for() loop or you can use split() as it returns an array then you can map() your array with conditions to push() into a new array then return a join().
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.
You can post solutions that invite discussion (like asking how the solution works, or asking about certain parts of the solution). But please don’t just post your solution for the sake of sharing it.
If you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler] and [/spoiler] tags on the line above and below your solution code.
A simple and efficient solution would be not to bother with making an array at all, but rather looping through the original string backwards and simply adding those characters in that order to a new string, and then return that string
function reverseString (string) {
//string is the input, and the value you wish to reverse
//newString will be the string you are constucting as a reversed form of string
let newString = "";
//A loop that can start at the end of the string, but I'll leave that up to you
for () {
//you should change newString such that it adds the values of string in here
}
//newString at this point should be a reversed string
return newString
}
As a bonus you won’t have to worry about any arrays