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

129
Views
Combine 2 matrices de diferentes longitudes y ordene la fecha

Tengo 2 matrices con diferentes longitudes.

let daysArray = ['09-20', '09-21', '09-22', '09-23', '09-24', '09-25', '09-26']

let weekNameArray = ['Mi', 'Do', 'Fr', 'Sa + So', 'Mo', 'Di' ]

combinándolos con _.zipWith:

 let weakDateArr = _.zipWith(weekNameArray, daysArray , function(first, second) { return first + " " + second });

Cómo puedo combinarlos para obtener la siguiente matriz:

['Mi 09-20', 'Do 09-21', 'Fr 09-22', 'Sa + So', 'Mo 09-25', 'Di 09-26']

'Sa + So' debe estar sin fecha *

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

0

Hmm, no estoy seguro de que lodash tenga soporte para esto listo para usar...

Puede aplicar una solución personalizada simple usando Array.map() y un desplazamiento de índice para daysArray :

 days_offset = 0; let combined = weekNameArray.map( (name, index) => { if(name.length <= 2) { return name + ' ' + daysArray[ index - days_offset ]; } else { days_offset += 1; return name; } });
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!