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

0

276
Views
pushing into an array inside an object using function it's returning Number instead of the value of pushed array

I tried to push into an array I just created within an object using function but it keeps returning numbers instead of the value pushed.

  const recordCollection ={
    5439: {
      albumTitle: 'ABBA Gold'
    }
  }
  function updateRecords(records, id, value){
    records[id].track = [];
    return  records[id].track.push(value)
  }
  console.log(updateRecords(recordCollection, 5439,'ABBA'));

according to my code, my result is supposed to be 'ABBA' but it keeps returning the size of the array instead

image of what i got

about 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error