everyutil
Version:
A comprehensive library of lightweight, reusable utility functions for JavaScript and TypeScript, designed to streamline common programming tasks such as string manipulation, array processing, date handling, and more.
14 lines (13 loc) • 372 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.reverseWords = void 0;
/**
* Reverses the order of words in a string (not the letters).
* @author @dailker
* @param {string} str
* @returns {string}
*/
function reverseWords(str) {
return str.split(/\s+/).reverse().join(' ');
}
exports.reverseWords = reverseWords;