• Jobs
  • About Us
  • Jobs
    • Home
    • Jobs
    • Courses and challenges
  • Businesses
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

146
Views
I tried to use the .map function but it didn't work on my code
async function getCategoryIds ()
{
    let response = axios.get( `${BASE_API_URL}categories?count=100` );
    let catIds = response.data.map( c => c.id );
    return _.samplesize( catIds, NUM_CATEGORIES )  
};

This is my code I tried to change the data in [] but it still don't work

over 3 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The main issue here is you have not used await in your code. adding await like the following should solve your problem -

let response = await axios.get( `${BASE_API_URL}categories?count=100` );
over 3 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Show me some job opportunities
There's an error!