-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
44 lines (35 loc) · 1.01 KB
/
Copy pathtest.js
File metadata and controls
44 lines (35 loc) · 1.01 KB
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
44
let promiseTocleanRoom = new Promise(function(resolve,reject) {
console.log("actually cleaning the roooom");
let isClean = true;
if(isClean){
resolve('Status:clean');
}
else {
reject('fromReject');
}
});
let cleanRoom = function() {
return new Promise(function(resolve,reject){
resolve('Cleaned the room');
});
};
let removeGarbage = function(message) {
return new Promise(function(resolve,reject){
resolve(message+' remove garbage');
});
};
let winIceCream = function(message) {
return new Promise(function(resolve,reject){
resolve(message+' Won Icecream');
});
};
promiseTocleanRoom.then(function(fromresolve) {
console.log('the room is ' + fromresolve);
}).catch(function(fromReject){
console.log('the room is'+ fromReject);
});
Promise.all([cleanRoom(),removeGarbage('I'), winIceCream('I')])
.then(
function(fromresolve){
console.log('Jobs ' + fromresolve);
});