Necesito obtener estas dos combinaciones de estas dos matrices como esta.
const array1 = [ '0', '4', '8', '16', '24', '32', '40', '48', '56', '64' ] const array2 = [ 'p', 'px', 'py', 'pt', 'pe', 'pb', 'ps', 'm', 'mx', 'my', 'mt', 'me', 'mb', 'ms'] // output 1 // const combine = {p: [p-0, p-4, p-8,...], px: [px-0, px-4, px-8,...].....} // output 2 // const combineUpdate = {p: ["", p-0, p-4, p-8,...], px: ["", px-0, px-4, px-8,...].....} // add an empty string in each 👆 array to get certain use case // we can access values like this // combine.p // combine.px // combineUpdate.msPuede asignar la primera matriz como prefijo de anuncio clave y obtener los valores de la otra matriz como sufijo.
const array1 = [ '0', '4', '8', '16', '24', '32', '40', '48', '56', '64' ], array2 = [ 'p', 'px', 'py', 'pt', 'pe', 'pb', 'ps', 'm', 'mx', 'my', 'mt', 'me', 'mb', 'ms'], result = Object.fromEntries(array2.map(k => [k, array1.map(v => [k, v].join('-'))])); console.log(result); .as-console-wrapper { max-height: 100% !important; top: 0; }