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

143
Views
Convert string array element to JS object

I'm trying to convert string to object with the below code:

wishlisted= [ '626601b89f1c16d0e42fd58e' ]
console.log(wishlisted.map(id => ({ id })));

Output for this came as:

[ { id: '626601b89f1c16d0e42fd58e' } ]

But from the output, I think id is of String type. I want to return it just like MongoDB's id, like: 626601b89f1c16d0e42fd58e, not as a string.

When I tried to check the type of id using:

console.log(typeof wishlisted[0].id);

it came as undefined. What could be the best way to do this type casting?

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!