JavaScrip Reverse Text
//more compact way:
"my example text".split("").reverse().join("");
Shiny Swan
//more compact way:
"my example text".split("").reverse().join("");
const solution = (str) => str.split("").reverse().join("");
function reverseString(str) {
return str.split("").reverse().join("");
}
reverseString("hello");
function reverseWords(str) {
const allWords = str.split(" ")
return allWords.map(item => item.split("").reverse().join("")).join(" ")
}
function reverseWords(str) {
const allWords = str.split(" ")
return allWords.map(item => item.split("").reverse().join("")).join(" ")
}
str.split('').reduce((reversed, character) =>{
return character + reversed;
}, '');
//apple = leppa