I am confused about async and await. to use an await, it should be in an async function, ok, but then how first one will start ?
I have a async function and it has awaits chain inside it. When I refresh it runs and I can see object values but later they disappear. getMyValues is my function and the problem is; when I debug, I can see objects and its values but its disappear when I want to use them later, only I can use strings I get from them, even they disappear sometimes.
So, I have few questions; Q1) Why object become undefined ? I know javascript objects are dynamic, but I see issue even I make a deepclone. How does it happen same session works again and even that session object becomes undefined..
async function getMyValues() {
// Initialize a session.
var session = await myclass.createSession(5)
var myValues = session.getValues()
I run like this;
getMyValues()
Q2) If I put return inside that function and run like that I can see a promise in debug..How to return a value from these kind of functions properly ?
let myvals = getMyValues()