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

132
Views
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 answers
Answer question

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 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!