JavaScript Odwróć ciąg
function reverseString(s){
return s.split("").reverse().join("");
}
reverseString("Hello");//"olleH"
Grepper
function reverseString(s){
return s.split("").reverse().join("");
}
reverseString("Hello");//"olleH"
//more compact way:
"my example text".split("").reverse().join("");
function reverse(str){
let reversed = "";
for (var i = str.length - 1; i >= 0; i--){
reversed += str[i];
}
return reversed;
}
const getReverseString = (text) => {
return text.split("").reverse().join("");
}
const solution = (str) => str.split("").reverse().join("");
str.split('').reduce((reversed, character) =>{
return character + reversed;
}, '');
//apple = leppa