es-next-tools
Version:
A comprehensive utility library for JavaScript and TypeScript that provides a wide range of functions for common programming tasks, including mathematical operations, date manipulations, array and object handling, string utilities, and more.
11 lines (10 loc) • 318 B
JavaScript
/**
* Reverses the characters in the string.
* @param {string} string - The string to reverse.
* @returns {string} A new string with the characters in reverse order.
* @example
* const reversed = reverse('hello'); // 'olleh'
*/
export function reverse(string) {
return string.split('').reverse().join('');
}