質問編集履歴
1
class構文を使用した記載に修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -42,24 +42,25 @@
|
|
42
42
|
どなたか教えてください。
|
43
43
|
|
44
44
|
```js
|
45
|
+
export default class TestClass {
|
45
|
-
async action(){
|
46
|
+
async action(){
|
46
|
-
|
47
|
+
await new Promise(function(resolve, reject){
|
47
|
-
|
48
|
+
console.log(0);
|
48
|
-
|
49
|
+
resolve('a');
|
49
|
-
|
50
|
+
})
|
50
|
-
|
51
|
+
.then(function(message){
|
51
|
-
|
52
|
+
console.log(1);
|
52
|
-
|
53
|
+
return message + 'b';
|
53
|
-
|
54
|
+
})
|
54
|
-
|
55
|
+
.then(function(message){
|
55
|
-
|
56
|
+
console.log(2);
|
56
|
-
|
57
|
+
console.log(message + 'c');
|
57
|
-
|
58
|
+
return message;
|
58
|
-
|
59
|
+
});
|
59
|
-
|
60
|
+
console.log(3);
|
61
|
+
}
|
60
62
|
}
|
61
|
-
|
62
|
-
var result = await action();
|
63
|
+
var result = await new TestClass().action();
|
63
64
|
console.log("4");
|
64
65
|
console.log(result + "d");
|
65
66
|
```
|