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

97
Views
What happens if you set an Array with a JSON Object value?

I'm struggling with a big JSON Object and I got into a weird problem:
My Object has the following structure:

const bar = {
  arr: []
}

If I try to set its value in this way bar.arr.foo = 'ciao' it doesn't give me any error. The result object is this

enter image description here

What is that strange "Array(0)" that the Chrome dev tools are pointing out? If I try to type typeof bar.arr it says "object"

But doing JSON.stringify(bar, null, 2) results in '{\n "arr": []\n}'

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!