Simple thing I found does not seem to me to do anything

Please look at this and tell me if I am wrong, or if there is some reason to do this?
Seems to me it is calling the same function over again, can this me right, let me know.
No big deal.

var asyncEngineCreation = async function() {
try {
return createDefaultEngine();
} catch(e) {
console.log(“the available createEngine function failed. Creating the default engine instead”);
return createDefaultEngine();
}
}

engine = await asyncEngineCreation();

The await operator is used to wait for a Promise. If the Promise is rejected, the await expression throws the rejected value.
It is not clear in your code what to do if Promise failed for some reasons.

1 Like