JavaScript membalikkan string
function reverseString(s){
return s.split("").reverse().join("");
}
reverseString("Hello");//"olleH"
Grepper
function reverseString(s){
return s.split("").reverse().join("");
}
reverseString("Hello");//"olleH"
function reverseString(s){
return s.split("").reverse().join("");
}
reverseString("Hello");//"olleH"
function spinWords(string){
//split("")the 5 letter word up ["h","e","l","l","o"]
let strArr=string.slice(0).split(" ");
console.log(strArr);
for(let i=0;i<=strArr.length-1;i++){
if(!strArr[i].length>=5)return strArr.join(" ");
if(strArr[i].length>=5) strArr[i]=strArr[i].split("").reverse().join("");
}
return strArr.join(" ");
}
const reverse = str => [...str].reverse().join``;