-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.js
40 lines (36 loc) · 1.14 KB
/
code.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
let inputLabel = document.getElementById('inputLabel');
function pushbtn(object){
let pushed = object.innerHTML;
let click = object.value;
if(pushed == '='){
inputLabel.innerHTML = eval(inputLabel.innerHTML);
setTimeout(function(){
let voice = new SpeechSynthesisUtterance();
voice.lang = "en-US";
voice.text = inputLabel.innerHTML;
voice.volume = 1;
voice.rate = 1;
voice.pitch = 1;
window.speechSynthesis.speak(voice);
}, 500);
}
else if(pushed == 'AC'){
inputLabel.innerHTML = '0';
}
else{
if(inputLabel.innerHTML == '0'){
inputLabel.innerHTML = pushed;
}
else{
inputLabel.innerHTML += pushed;
}
}
console.log("hello Btn is working");
let voice = new SpeechSynthesisUtterance();
voice.lang = "en-US";
voice.text = click;
voice.volume = 1;
voice.rate = 1;
voice.pitch = 1;
window.speechSynthesis.speak(voice);
}