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

194
Views
Asignación a la propiedad del parámetro de función 'elemento'

tengo ese error de pelusa: Asignación a la propiedad del parámetro de función 'elemento'

¿Cuál es la forma correcta de eliminar este error?

 const resp = await getData(payload) resp.forEach((item) => { item[0] = moment(item[0]).format('DD/MMM/YY'); });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Aquí hay un ejemplo con map .

 const response = [ [ "07/10/2020", 0.04, 0.05, 0.04 ], [ "07/10/2020", 0.04, 0.06, 0.04 ] ]; // Iterate over the response const data = response.map(item => { // For each item destrucuture the data from // the rest of the elements const [date, ...rest] = item; // Return a new array which has the updated // date, and the other elements then spread out return [ moment(new Date(date)).format('DD/MMM/YY'), ...rest ]; }); console.log(data);
 <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>

Documentación adicional

  • map

  • Asignación de desestructuración

  • Difundir sintaxis

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!