|
@@ -34,14 +34,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
- let delay2 = function (f, time) {
|
|
|
+ let delay2 = function (time) {
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
console.log("delay starsing")
|
|
|
- setTimeout(f, time);
|
|
|
+ setTimeout(() => resolve("Delay was first"), time);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- Promise.race([delay2(() => console.log("delay end"), 250), myfetch("https://swapi.dev/api/people/1/").then(luke => console.log(luke))]);
|
|
|
+ Promise.race([delay2(95), myfetch("https://swapi.dev/api/people/1/")]).then(res => console.log(res));
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|