From d2917bf1200c72eb7877c66de090a0fc1f2ee707 Mon Sep 17 00:00:00 2001 From: Meet Zaveri Date: Thu, 14 Dec 2017 23:02:18 +0530 Subject: [PATCH] Update Speech_synthesis.md --- snippets/Speech_synthesis.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/snippets/Speech_synthesis.md b/snippets/Speech_synthesis.md index db1e084cd..022601472 100644 --- a/snippets/Speech_synthesis.md +++ b/snippets/Speech_synthesis.md @@ -6,11 +6,10 @@ It contains the content the speech service should read and information about how To know more - https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance ``` -speak = message => { - const msg = new SpeechSynthesisUtterance(message) - const voices = window.speechSynthesis.getVoices() - msg.voice = voices[0] - window.speechSynthesis.speak(msg) - } +const speak = message => { + const msg = new SpeechSynthesisUtterance(message); + msg.voice = window.speechSynthesis.getVoices()[0]; + window.speechSynthesis.speak(msg); +} speak('Hello, World') ```