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

156
Views
Agregar un prefijo a la clave de un objeto en axios

tengo el objeto

 data = { others: [ { code: "A", label: "0-A" }, { code: "B", label: "0-B" }, ..., { code: "N", label: "0-N" } ] }

Y necesito agregar el prefijo other_ al valor del code (ejemplo, other_N ) antes de enviarlo a la consulta axios:

 await axios.post(`${URL}`, { data })
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Algo como esto

 let data = { others: [{ code: "A", label: "0-A" }, { code: "B", label: "0-B" }, { code: "N", label: "0-N" } ] }; let modifiedData = data.others.map(x => { x.code = `other_${x.code}`; return x; }) console.log(modifiedData);

about 4 years ago · Juan Pablo Isaza Report

0

puede usar la función Array.map para manipular el objeto de datos

 data.others.map(x => { return { other_code: x.code, label: x.label }})
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!