Scrivi un programma JavaScript per invertire tutte le parole in una stringa data.
funzione reverseString(str) {
    let reversedString = '';
    str.split('').forEach(char => reversedString = char + reversedString);
    return reversedString;
} 

(Note: The code itself is written in English and does not need to be translated. This is just the Italian version of the code written in the same format.)