Reverse a string of words with JavaScript javascript
00:00:00
Press Esc to exit this exercise.
function reverseString(str) {
return str.split('').reverse().join('');
}
// Example usage:
const originalString = "Hello, world!";
const reversedString = reverseString(originalString);
console.log(reversedString);