functionreverseWords(str){letwordbuf="";letoutbuf="";for(letcharofstr){// NOTE replace with `if (/\s/.test(char))`// if anything other than ASCII whitespace// char expectedif(char===""){outbuf+=(wordbuf+char);wordbuf="";}else{wordbuf=char+wordbuf;}}outbuf+=wordbuf;returnoutbuf;}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
JavaScript (imperative & linear):