I'm wondering if async/await behave the same in the following two 'super-basic' examples:
async function blah1() {
return await foo.bar().then('Done');
}
as this
async function blah2() {
return blah3(foo.bar());
}
async function blah3(fn) {
return await fn.then('Done');
}
or is there some important difference?
- Yes I know 'return await' is redundant but I left it in for this example :)
thenexpecting a function, or, "If it is not a function, it is internally replaced with an "Identity" function". Then you wrote "done" once, then "Done". Last but least, there are semantical differences, depending on how you use these functions, but understanding the signatures comes first.