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

153
Views
Get value from an array using find in JavaScript

I've got an array:

test = [{'id':'73','name':'bar', 'contact': [{'name':'barFoo','tel':'3333'}]},{'id':'45','name':'foo', 'contact':[]}]

I try to get contact.tel in first object with 'id':'73'

I'm using find method :

let contactTel = test.find(x => x.id === '73').contact.tel;

but it dosen't work. What I'm doing wrong ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

it should be like this

const test = [{'id':'73','name':'bar', 'contact': [{'name':'barFoo','tel':'3333'}]},{'id':'45','name':'foo', 'contact':[]}]


let contactTel = test.find(x => x.id === '73').contact[0].tel;

console.log(contactTel)

about 4 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 Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!