Похожие чаты

Const App = Async() => {  Var CountryData = [];     Await (Axios.Request(Options)     .Then(Function (Response) {       Response.Data.Map((Item) =>       CountryData.Push( Item.Name)       )}     )     .Catch(Function (Error) {       Console.Error(Error);     }))     Return CountryData; }; Why this function doesn't return an array?! How to get it

to return array?

7 ответов

26 просмотров

What does it return?

Y- Автор вопроса
Simen
What does it return?

I kind of solved it by removing async await and returns array but can not do map on it Map returns nothing

What does this code return?

This code shows you haven't quite grasped async/await, Array.prototype.map, or promises yet. It mixes async/await with promise chains. In most cases, you pick one or the other It uses Array.prototype.map to modify another array

If you console.log(app ()) you won't get anything yet cause it is an async function that means it returns a promise. The thing is it does return an array but you only can't access it yet. So the correct method to do and let use console.log as example you have to do it like this : app ().then (arr=>console.log (arr))

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта