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

159
Views
¿Cómo combinar dos números entre una matriz de números con javascript?

Tengo una matriz de números y me gustaría generar todas las combinaciones posibles con 2 números como se muestra en el esperado

 const numbers = [1,2,3];

Esperado:

 const result = [ [1,2], [1,3], [2,1], [2,3], [3,1], [3,2] ]
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

 let num = [1,2,3]; let arr = []; for(let i=0; i<num.length; i++){ for(let j=0; j<num.length; j++){ if(j === i) continue; arr.push([num[i], num[j]]); } } console.log(arr);

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!