Skip to content

Instantly share code, notes, and snippets.

@mugi-uno
Last active August 24, 2022 10:09
Show Gist options
  • Save mugi-uno/7cbf6e62023a741f8fe4146f6bd2ed6c to your computer and use it in GitHub Desktop.
Save mugi-uno/7cbf6e62023a741f8fe4146f6bd2ed6c to your computer and use it in GitHub Desktop.
yumemi
const add = (a: number, b: number): number => {
let l = true; const check = () => { const r = new (window.SpeechRecognition || window.webkitSpeechRecognition)(); r.lang='en'; r.onresult = ({results}) => { const word = results.item(0).item(0).transcript; l = word !== 'water'; if (l) { alert('NG:' + word); check(); } else { alert(`๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰Congratulations๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰\n\n${yeah(a,b)}`); }; }; r.start(); }; check(); } ;function yeah(a, b) {
return a + b;
}
add(1,2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment