Since caller() is an async function and await has not been called on it - it will execute in an async manner. This means it may move on to the next line of code, before execution has been completed, If the order of execution matters ( you want to execute in an a sync manner ) you need to use await OR use .then()