[javascript] Why is my variable unaltered after I modify it inside of a function? - Asynchronous code reference