Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

111
Views
Storing data from API to Arr

I'm trying to take data from the API and put it in a array so I can manipulate it. I created a function that adds data from the API to a array . But the data from the array is only visible in the browser console, not in the .js file. Also i cant do forEach from js but can from console :/.

ForEach in browser console

  let users = [];


    async function getUsersData() {
        try {
            const url = 'https://jsonplaceholder.typicode.com/users'
            const response = await fetch(url)
            const data = await response.json()
            settData(data)

        } catch (eror) {
            console.log('jbg puce')
        }
    }


    function settData(data) {
        users.push(...data)

    }


    getUsersData()
    console.log(users)
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!