Ver originalfunction removeLastWord(str) { return str.replace(/\s?[^\s]+$/, '');}removeLastWord('hello lovely world'); // "hello lovely"