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

128
Vistas
How to order two arrays as a for manner

I mean: I have two arrays, number, and name

const number = ['91xxxx','1xxxx','92xxxx']
const name = ['Abhi','Arun','Aaron']

Here I want to order these two arrays in the following manner:

1st number in the array that is number[0], its name must be name[0] and number[1], for name[1], like that.

But That arrays are user preference, what I mean is users can add their number and name there unlimitedly but I want to keep in the above manner, How should I do????

I have made a code:

async function getAllOwners() {
   var nam = ''
   var num = ''
   number.map(async (nu) => {
      num = nu
   })
   name.map(async (na) => {
      nam = na
   })
    return nam for num;
}

But I don't know whether this works or not.

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

0

I suggest that you will have a different function for pushing new data and retrieving the data.

function getAllOwners() {
return name.map((_name,index)=>_name+' '+number[index])
}// Output: [ 'Abhi 91xxxx', 'Arun 1xxxx', 'Aaron 92xxxx' ]

*Note that there's no need for the async keyword for there's no asynchronous operation here.

function addOwner(_name,num){
name.push(_name)
number.push(num)
}
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