1function reverseString(s){
2 return s.split("").reverse().join("");
3}
4reverseString("Hello");//"olleH"
1function reverseString(str) {
2 return str.split("").reverse().join("");
3}
4reverseString("hello");
1function reverse (word) {
2 word = word.split('.').reverse().join('.')
3 return word
4
5}
6word = 'i.like.this.program.very.much'
7word = 'pqr.mno'
8console.log(reverse(word))
9
1function reverseWords(str) {
2 const allWords = str.split(" ")
3 return allWords.map(item => item.split("").reverse().join("")).join(" ")
4}
1function reverseInPlace(str) {
2 var words = [];
3 words = str.match(/\S+/g);
4 var result = "";
5 for (var i = 0; i < words.length; i++) {
6 result += words[i].split('').reverse().join('') + " ";
7 }
8 return result
9}
10console.log(reverseInPlace("abd fhe kdj"))