When I return the temp variable it returns a promise instead of value. So does anyone know how to solve this?
For further actions, you may consider blocking this person and/or reporting abuse
When I return the temp variable it returns a promise instead of value. So does anyone know how to solve this?
For further actions, you may consider blocking this person and/or reporting abuse
simprl -
Habib Hinn -
babar ali -
Megan Lee -
Top comments (2)
Code example?
Generally, this means that your 'results' are 'wrapped' in a
Promise
. You can chain a.then(
afterwards to try to resolve this.You can chat me if you need some additional basic help with this.
Also, you should add the tag '#help' on your post.
Good luck.
To get the the value from a function that returns a promise you either need to append "then" with the function like
myFunc(params).then((data)=>{
console.log(data)
})
else much better is to use async await syntax
const data = await myFunc(params)
dont forget to mark the parent function async to use await inside it..