解法1:
var reverseWords = function(s) {
let s1=s.split(' ').reverse();
let s2= [];
for(let i =0;i<s1.length;i++){
if(s1[i].length>0) {
s2.push(s1[i]);
}
}
return s2.join(' ');
};
解法1:
var reverseWords = function(s) {
let s1=s.split(' ').reverse();
let s2= [];
for(let i =0;i<s1.length;i++){
if(s1[i].length>0) {
s2.push(s1[i]);
}
}
return s2.join(' ');
};