-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
58 lines (37 loc) · 987 Bytes
/
main.js
File metadata and controls
58 lines (37 loc) · 987 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
function calculation(){
this.demoAsync=async function(value1,value2){
return await new Promise((resolve)=>{
let sum=value1 + value2;
return resolve(sum);
});
}
}
function main(){
this.funcCall=async function(value1,value2){
let calculationObj=new calculation();
let sum=await calculationObj.demoAsync(value1,value2);
console.log(sum);
}
this.funcCall1=async function(value1,value2)
{
let calculationObj=new calculation();
let sum=await calculationObj.demoAsync(value1,value2);
return sum;
}
}
let mainObj=new main();
mainObj
.funcCall(2,2)
.then(x=> x);
mainObj
.funcCall1(3,5)
.then((x)=> console.log(x));
class test {
async demo(){
return await new Promise((resolve)=>{
return resolve(console.log("Test Done"));
});
}
}
let testObj=new test();
testObj.demo().then((x)=>x);