Last updated 4 years ago
Was this helpful?
split as word array
reverse process-1
Join process-1 with empty spaces.
const reverseWords = (str) => str.split(' ').reverse().join(' ');