-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAsynchronous.js
More file actions
26 lines (25 loc) · 786 Bytes
/
Asynchronous.js
File metadata and controls
26 lines (25 loc) · 786 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
// function task1(){
// console.log("Task1 started");
// console.log("Task1 got over");
// }
// function task2(){
// console.log("Task2 started");
// let start=Date.now();
// let delay=4000;
// let end=start+delay;
// console.log("Task2 completed");
// }
// function task3(){
// console.log("Task3 started");
// console.log("Task3 got over");
// }
// task1();
// setTimeout(task2,2000);
// task3();
function fun1(){
console.log("Fetching the data");
}
let intervalID=setInterval(fun1,2000);
setTimeout(()=>clearInterval(intervalID),10000);//used inorder to stop the excution we make use of this line.
//function doesn't have any name,it has only single line body and doesn't have any parameters
// clearInterval(intervalID);takes only 1 argument