Open jzhangnu opened 7 years ago
var reverseWords = function(str) { str.reverse(); for(var i = 0; i < str.length; i++){ var j = i; while(str[j] !== ' ' && str[j])j++; var jj = j - 1, ii = i; while(jj > ii){ [str[ii], str[jj]] = [str[jj], str[ii]]; ii++; jj--; } //while i = j; } //for };