Closed akelmj closed 7 years ago
when i call this function i get: undefined
for example:
var r = amazonGetItem('B002SSUQFG'); function amazonGetItem(asin) { var result; client.itemLookup({ idType: 'ASIN', itemId: asin }).then(function (results) { result = results; }).catch(function (err) { console.log(err); result = ''; }); return result; }
i want to wait untill the temLookup return data?
thanks.
Yes, because you returned the result value before it was assigned in the Promise.
result
There is a lot of asynchronous computations in javascript and nodejs. I recommend you to get familiar with it!
when i call this function i get: undefined
for example:
i want to wait untill the temLookup return data?
thanks.