回答編集履歴
5
typo
test
CHANGED
@@ -92,6 +92,32 @@
|
|
92
92
|
|
93
93
|
});
|
94
94
|
|
95
|
+
Promise.all([p(0),p(1),p(2)]).then(()=>{
|
96
|
+
|
97
|
+
console.log('step 1');
|
98
|
+
|
99
|
+
Promise.all([p(3),p(4),p(5)]).then(()=>{
|
100
|
+
|
101
|
+
console.log('step 2');
|
102
|
+
|
103
|
+
Promise.all([p(6),p(7),p(8)]).then(()=>{
|
104
|
+
|
105
|
+
console.log('end');
|
106
|
+
|
107
|
+
});
|
108
|
+
|
109
|
+
});
|
110
|
+
|
111
|
+
});
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
```
|
116
|
+
|
117
|
+
# 参考
|
118
|
+
|
119
|
+
```javascript
|
120
|
+
|
95
121
|
const plist=[
|
96
122
|
|
97
123
|
{text:"1",wait:1000},
|
@@ -126,34 +152,6 @@
|
|
126
152
|
|
127
153
|
});
|
128
154
|
|
129
|
-
|
130
|
-
|
131
|
-
Promise.all([p(0),p(1),p(2)]).then(()=>{
|
132
|
-
|
133
|
-
console.log('step 1');
|
134
|
-
|
135
|
-
Promise.all([p(3),p(4),p(5)]).then(()=>{
|
136
|
-
|
137
|
-
console.log('step 2');
|
138
|
-
|
139
|
-
Promise.all([p(6),p(7),p(8)]).then(()=>{
|
140
|
-
|
141
|
-
console.log('end');
|
142
|
-
|
143
|
-
});
|
144
|
-
|
145
|
-
});
|
146
|
-
|
147
|
-
});
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
```
|
152
|
-
|
153
|
-
# 参考
|
154
|
-
|
155
|
-
```javascript
|
156
|
-
|
157
155
|
(async ()=>{
|
158
156
|
|
159
157
|
await (async (...args)=>{await Promise.all(args.map(arg=>p(arg)));})(0,1,2);
|
4
all
test
CHANGED
@@ -92,6 +92,40 @@
|
|
92
92
|
|
93
93
|
});
|
94
94
|
|
95
|
+
const plist=[
|
96
|
+
|
97
|
+
{text:"1",wait:1000},
|
98
|
+
|
99
|
+
{text:"2",wait:0},
|
100
|
+
|
101
|
+
{text:"3",wait:500},
|
102
|
+
|
103
|
+
{text:"4",wait:0},
|
104
|
+
|
105
|
+
{text:"5",wait:1000},
|
106
|
+
|
107
|
+
{text:"6",wait:500},
|
108
|
+
|
109
|
+
{text:"7",wait:500},
|
110
|
+
|
111
|
+
{text:"8",wait:1000},
|
112
|
+
|
113
|
+
{text:"9",wait:0},
|
114
|
+
|
115
|
+
];
|
116
|
+
|
117
|
+
const p=n=>new Promise((resolve)=>{
|
118
|
+
|
119
|
+
setTimeout(()=>{
|
120
|
+
|
121
|
+
console.log(plist[n].text);
|
122
|
+
|
123
|
+
return resolve();
|
124
|
+
|
125
|
+
},plist[n].wait);
|
126
|
+
|
127
|
+
});
|
128
|
+
|
95
129
|
|
96
130
|
|
97
131
|
Promise.all([p(0),p(1),p(2)]).then(()=>{
|
3
調整
test
CHANGED
@@ -122,15 +122,15 @@
|
|
122
122
|
|
123
123
|
(async ()=>{
|
124
124
|
|
125
|
-
await (async ()=>{await Promise.all(
|
125
|
+
await (async (...args)=>{await Promise.all(args.map(arg=>p(arg)));})(0,1,2);
|
126
126
|
|
127
127
|
console.log("step 1");
|
128
128
|
|
129
|
-
await (async ()=>{await Promise.all(
|
129
|
+
await (async (...args)=>{await Promise.all(args.map(arg=>p(arg)));})(3,4,5);
|
130
130
|
|
131
131
|
console.log("step 2");
|
132
132
|
|
133
|
-
await (async ()=>{await Promise.all(
|
133
|
+
await (async (...args)=>{await Promise.all(args.map(arg=>p(arg)));})(6,7,8);
|
134
134
|
|
135
135
|
console.log("end");
|
136
136
|
|
2
さんこう
test
CHANGED
@@ -114,8 +114,26 @@
|
|
114
114
|
|
115
115
|
|
116
116
|
|
117
|
+
```
|
117
118
|
|
119
|
+
# 参考
|
118
120
|
|
121
|
+
```javascript
|
119
122
|
|
123
|
+
(async ()=>{
|
124
|
+
|
125
|
+
await (async ()=>{await Promise.all([p(0),p(1),p(2)])})();
|
126
|
+
|
127
|
+
console.log("step 1");
|
128
|
+
|
129
|
+
await (async ()=>{await Promise.all([p(3),p(4),p(5)])})();
|
130
|
+
|
131
|
+
console.log("step 2");
|
132
|
+
|
133
|
+
await (async ()=>{await Promise.all([p(6),p(7),p(8)])})();
|
134
|
+
|
135
|
+
console.log("end");
|
136
|
+
|
137
|
+
})();
|
120
138
|
|
121
139
|
```
|
1
chousei
test
CHANGED
@@ -58,9 +58,7 @@
|
|
58
58
|
|
59
59
|
```javascript
|
60
60
|
|
61
|
-
var p=[];
|
62
|
-
|
63
|
-
|
61
|
+
const plist=[
|
64
62
|
|
65
63
|
{text:"1",wait:1000},
|
66
64
|
|
@@ -82,31 +80,29 @@
|
|
82
80
|
|
83
81
|
];
|
84
82
|
|
85
|
-
p
|
83
|
+
const p=n=>new Promise((resolve)=>{
|
86
84
|
|
87
|
-
|
85
|
+
setTimeout(()=>{
|
88
86
|
|
89
|
-
set
|
87
|
+
console.log(plist[n].text);
|
90
88
|
|
91
|
-
|
89
|
+
return resolve();
|
92
90
|
|
93
|
-
return resolve();
|
94
|
-
|
95
|
-
|
91
|
+
},plist[n].wait);
|
96
|
-
|
97
|
-
});
|
98
92
|
|
99
93
|
});
|
100
94
|
|
95
|
+
|
96
|
+
|
101
|
-
Promise.all([p
|
97
|
+
Promise.all([p(0),p(1),p(2)]).then(()=>{
|
102
98
|
|
103
99
|
console.log('step 1');
|
104
100
|
|
105
|
-
Promise.all([p
|
101
|
+
Promise.all([p(3),p(4),p(5)]).then(()=>{
|
106
102
|
|
107
103
|
console.log('step 2');
|
108
104
|
|
109
|
-
Promise.all([p
|
105
|
+
Promise.all([p(6),p(7),p(8)]).then(()=>{
|
110
106
|
|
111
107
|
console.log('end');
|
112
108
|
|
@@ -120,4 +116,6 @@
|
|
120
116
|
|
121
117
|
|
122
118
|
|
119
|
+
|
120
|
+
|
123
121
|
```
|