Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

170
Vistas
To make SKU combination in JS

Let's just say I have an array with n number of index:

0:{prop1: 'abc', prop2: ['1', '2', '3'],
1:{prop1: 'xyz', prop2: ['8', '6']

Now, what I am trying to make is a combination like this:

(1,8)
(1,6)
(2,8)
(2,6)
(3.8)
(3,6)

I have tried multiple methods couldn't achieve this combination

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Check CartesianProduct class from package js-combinatorics, I think this is the right tool for your task:

let it = new CartesianProduct('123','86');
it.length;  // 6
[...it];    /* [
  ['1', '8'],
  ['2', '8'],
  ['3', '8'],
  ['1', '6'],
  ['2', '6'],
  ['3', '6']
] */
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda