Speak guessing number game with Javascript
course from Brad Traversy
Feature:
SpeechRecongnition Web API
HTML
msg is the container to show the user speaking content and also a selected messageCSS
style the play-again buttonFirst, generate the random number to be the right answer
format the number with Math.floor() to get a number between 1-100
If you do have Firefox browser, make sure the function is true.
Firefox
search "about:config" ,enable to change
search "speech", "media.web speech.recognition.force_enable" and "media.web speech.recognition" to true
Make sure Chrome supported: MDN
var SpeechRecognition = SpeechRecognition || webkitSpeechRecognitionSpeechRecognition.start()SpeechRecognition.resultAlso available via the
onresult property.when speaking"hello" to mic, console log "e"
then write the message to the DOM and check the numberif the number is not in 1-100, show the message reminder
if the speaking number is the same as the right number, show the congrats message and a play again button
if the number is too large or small, show the message
when clicking the play again button, reload the window











