Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

131
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda