1varfunc1=function(){2returnnewPromise(function(resolve){3var sum =1+1;//処理1 (15分掛かる処理)4resolve(sum);5})6}78varfunc2=function(){9returnnewPromise(function(resolve){10var sum =2+2;//処理2 (10分掛かる処理)11resolve(sum);12})13}1415varfunc3=function(){16returnnewPromise(function(resolve){17var sum =3+3;//処理3 (5分掛かる処理)18resolve(sum);19})20}2122func1().then(function(sum){console.log(sum)});23func2().then(function(sum){console.log(sum)});24func3().then(function(sum){console.log(sum)});
1varfunc1=function(){2returnnewPromise(function(resolve){3setTimeout(function(){4var sum =1+1;//処理1 (15分掛かる処理)5resolve(sum);6},0);7})8}910varfunc2=function(){11returnnewPromise(function(resolve){12setTimeout(function(){13var sum =2+2;//処理2 (10分掛かる処理)14resolve(sum);15},0);16})17}1819varfunc3=function(){20returnnewPromise(function(resolve){21setTimeout(function(){22var sum =3+3;//処理3 (5分掛かる処理)23resolve(sum);24},0);25})26}2728func2().then(function(sum){console.log(sum)});29func1().then(function(sum){console.log(sum)});30func3().then(function(sum){console.log(sum)});
1varfunc1=function(){2returnnewPromise(function(resolve,reject){3setTimeout(function(){4var sum =1+1;5resolve(sum);6},1500);7});8}9varfunc2=function(){10returnnewPromise(function(resolve){11setTimeout(function(){12var sum =2+2;13resolve(sum);14},1000);15});16}17varfunc3=function(){18returnnewPromise(function(resolve){19setTimeout(function(){20var sum =3+3;21resolve(sum);22},500);23});24}25func2().then(function(sum){26console.log(sum);27func1().then(function(sum){28console.log(sum);29func3().then(function(sum){30console.log(sum)31});32});33});34