-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtime.js
More file actions
30 lines (22 loc) · 601 Bytes
/
time.js
File metadata and controls
30 lines (22 loc) · 601 Bytes
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
let output = document.querySelector('div')
let textbox = document.querySelector('input')
let wordsToType ="hello world this is typing";
let timeDispalyer = document.querySelector('[data-time-display]')
let time = 200;
function timer (){
time --
timeDispalyer.innerHTML = time
// console.log(time);
}
let timing = setInterval(timer, 1000);
setTimeout(() => {
clearTimeout(timing)
}, 200*1000);
textbox.oninput= (e)=>{
for (let i = 0; i < wordsToType.length; i++) {
const element = wordsToType[i];
if (element == e.target.value[i]) {
console.log(element);
}
}
}