Update Speech_synthesis.md

used es6 approach acc. to contributing guidelines
This commit is contained in:
Meet Zaveri
2017-12-14 22:39:24 +05:30
committed by GitHub
parent 0ab7ee90e2
commit 530e4e411a

View File

@ -6,11 +6,11 @@ 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 To know more - https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance
``` ```
function speak (message) { speak = message => {
var msg = new SpeechSynthesisUtterance(message) var msg = new SpeechSynthesisUtterance(message)
var voices = window.speechSynthesis.getVoices() var voices = window.speechSynthesis.getVoices()
msg.voice = voices[0] msg.voice = voices[0]
window.speechSynthesis.speak(msg) window.speechSynthesis.speak(msg)
} }
speak('Hello, world') speak('Hello, World')
``` ```