/**
* @param {string} s
* @return {string}
*/
var reverseWords = function(s) {
let newArray =[];
let arraySplit = s.split(' ').filter(str => str);
for(let i=0; i<arraySplit.length; i++){
let reverseStr = arraySplit[i].split('').reverse().join('')
newArray.push(reverseStr);
};
return newArray.join(" ");
};
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (3)
simple & clean KUDOS
I just wanted to try it and came up with this...
Yeah, both ways work..