const uppercaseWords = str => str.replace(/^(.)|s+(.)/g, c => c.toUpperCase()); // Example uppercaseWords('hello world'); // 'Hello World'