Array.prototype.reverseintermediateconst sentence = 'one two three'
sentence.split(' ').reverse().join(' ')
// β 'three two one'Use split, reverse, and join to reverse the order of words in a sentence.
Split the sentence into words, reverse the word array, then join them back together.
'hello world'.split(' ').reverse().join(' ') // 'world hello'