I am trying to access the value in Promise outside the then function using JavaScript. I am new to Promise and I not sure if I am doing it correctly. Here is my code:
//removed code
Basically I have store the value returned by Promise into a separate variable inside the then function. I wanted to access them at the later part, but when I print them out at later part, it returns me undefined. Any ideas on how to resolve this?
I have found examples and followed them but it does not work. I not sure which part of my code was wrong. I opened a thread earlier on and it was marked as duplicate and closed. I guess my inquiry wasn't clear enough, therefore I am rephrasing the question here.