JavaScriptのPromise 4
JavaScriptのPromise
by Jirobe
TypeScript
let count = 0;
function promiseTest(): Promise {
console.log(++count);
return new Promise((resolve) => {
resolve();
});
}
promiseTest()
.then( () => {
console.log(++count);})
.then( () => {
console.log(++count);})
.then( () => {
console.log(++count);})
.then( () => {
console.log(++count);})
.then( () => {console.log(`last:` + count);})