File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 11# Clearing SetTimeout with JavaScript
2- An awe-inspiring software for proactve purposes in an orgainzation
2+ An awe-inspiring software for proactive security purposes in an orgainzation.
3+
4+
Original file line number Diff line number Diff line change 1+ let output = document . querySelector ( 'div' )
2+ let textbox = document . querySelector ( 'input' )
3+ let wordsToType = "hello world this is typing" ;
4+ let timeDispalyer = document . querySelector ( '[data-time-display]' )
5+
6+ let time = 200 ;
7+
8+ function timer ( ) {
9+ time --
10+
11+ timeDispalyer . innerHTML = time
12+ // console.log(time);
13+ }
14+
15+ let timing = setInterval ( timer , 1000 ) ;
16+
17+ setTimeout ( ( ) => {
18+
19+ clearTimeout ( timing )
20+ } , 200 * 1000 ) ;
21+
22+ textbox . oninput = ( e ) => {
23+ for ( let i = 0 ; i < wordsToType . length ; i ++ ) {
24+ const element = wordsToType [ i ] ;
25+ if ( element == e . target . value [ i ] ) {
26+ console . log ( element ) ;
27+ }
28+
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments