Palavras reversas em um javascript de string
function reverseString(str) {
return str.split("").reverse().join("");
}
reverseString("hello");
Unsightly Unicorn
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 reverseInPlace(str) {
var words = [];
words = str.match(/\S+/g);
var result = "";
for (var i = 0; i < words.length; i++) {
result += words[i].split('').reverse().join('') + " ";
}
return result
}
console.log(reverseInPlace("abd fhe kdj"))