-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprojectasync1.js
43 lines (32 loc) · 952 Bytes
/
projectasync1.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
41
42
43
// const changeobj = function()
// {
// document.querySelector("#head1").innerHTML = "Async Javascript";
// }
// const timer = function(){
// console.log("Kirtti");
// };
// const stopobj = setTimeout(changeobj, 2000);
// document.querySelector("#stop").addEventListener("click", function()
// {
// clearTimeout(stopobj);
// console.log("Stopped");
// })
// document.querySelector("#resume").addEventListener("click", function(){
// setTimeout(changeobj,2000);
// console.log("Resumed");
// })
//setInterval : Means at a same interval time work this
//ex:
let startstop;
const starting = function(){
console.log("Kirtti");
};
document.querySelector("#start")
.addEventListener("click", function(){
startstop = setInterval(starting,1000);
console.log("Started");
})
document.querySelector("#stop").addEventListener("click", function(){
clearInterval(startstop);
console.log("Stopped");
})