const speak = (msg) => { const sp = new SpeechSynthesisUtterance(msg); [sp.voice] = speechSynthesis.getVoices(); speechSynthesis.speak(sp); } speak('Hi, Welcome to Javascript Text to Speech. It is really awesome.');