-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript-10_setTimeout.js
33 lines (18 loc) · 1.07 KB
/
script-10_setTimeout.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
// Using strict mode
"use strict";
console.log("Hey everybody what's up !!!");
console.log('\n');
/* -------------------------------------------------------------------------------------------------------------------------- */
// Examples of a callback function
// Defining the Callback function inside the setTimeout function
setTimeout( () => { console.log("Wait for it you mother-fucker !!! \n\n "); } , 5000 );
// Defining the Callback functions outside the setTimeout function
function clbck1() { console.log(`Hi , Iam a callback function without arguments !!!\n\n`); }
setTimeout( clbck1 , 3000 ); // Callback function clbk1 without any arguments
function clbk2(name) { console.log(`Hi ${name} , Iam a callback function with arguments !!! \n\n `); }
setTimeout( clbk2 , 4000 , "Oliver" ); // Callback function clbk2 with argument "Oliver"
/* ------------------------------------------------------------------------------------------------------------------------- */
console.log("Hey assholes !!!");
console.log('\n');
console.log("See you sometime !!!");
console.log('\n');