File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 " />
5
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6
+ < title > Async Javascript with Two Projects</ title >
7
+ </ head >
8
+ < body >
9
+ < h1 id ="name "> Waseem Malik</ h1 >
10
+ < button id ="stop "> stop</ button >
11
+ </ body >
12
+ < script >
13
+ // console.log("is js working");
14
+ // setTimeout(() => {
15
+ // console.log("waseem akram");
16
+ // }, 2000); //time in milli-seconds=> 1s=1000
17
+ // function changeh1() {
18
+ // const changeName = document.getElementById("name");
19
+ // changeName.innerHTML = "hafiz Fahad iqbal";
20
+ // }
21
+
22
+ // const stop = setTimeout(changeh1, 3000);
23
+
24
+ // document.querySelector("#stop").addEventListener("click", function () {
25
+ // clearTimeout(stop);
26
+ // console.log("STOPPED");
27
+ // });
28
+ </ script >
29
+ </ html >
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 " />
5
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6
+ < title > Async Javascript with Two Projects</ title >
7
+ </ head >
8
+ < body >
9
+ < h1 id ="name "> M Talha Makhdoom</ h1 >
10
+ < button id ="start "> start</ button >
11
+ < button id ="stop "> stop</ button >
12
+ </ body >
13
+ < script >
14
+ // console.log("is js working");
15
+ // setInterval(() => {
16
+ // console.log("waseem akram", Date.now());
17
+ // }, 1000);
18
+
19
+ const sayDate = function ( str ) {
20
+ console . log ( str , Date . now ( ) ) ; //you can use default value also just like i passed it as parameter str whcih value is hi
21
+ } ;
22
+ const stopInterval = setInterval ( sayDate , 1000 , "hi" ) ;
23
+
24
+ document . getElementById ( "stop" ) . addEventListener ( "click" , ( ) => {
25
+ clearInterval ( stopInterval ) ;
26
+ } ) ;
27
+ </ script >
28
+ </ html >
You can’t perform that action at this time.
0 commit comments