im doing an api call to get two dates. As soon as I have those dates, they are saved in the object "values" and get resolved.
let parsedBody = JSON.parse(body)
let values = {
start: parsedBody.start.dateTime,
end: parsedBody.end.dateTime
}
resolve(values)
Also I have a variable, which calls the function where the upper api call is made.
let datesByMSId = await this.entrybyMSId(msId)
I have the following problem: I want to use the values which are saved in datesByMSId seperately. A.e. I want to log the start element from the object.
Greetings, Leo
CodePudding user response:
The Problem with logging datesByMSId.start was that I didnt use a type. For a quick fix I had to use any as a type like the following: let datesByMSId:any = await this.entrybyMSId(msId)
CodePudding user response:
You can simply read these values by accessing object properties :
console.log(datesByMSId.start);
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects