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

238
Views
Array accending and descending javascript

Create a program that will allow you to enter a number of integers to input. Then input values for those integers and store them into an array(Array A). After that, create another array(Array B) that will store the doubled value of elements from the first array. Display the two arrays. Display also the ascending order of the first array and the descending order of the second array.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

look into array mapping (and arrow functions to make life easier)

e.g. var newNumbers = numbers.map(n => n*2) Will return another array with all the elements of the numbers array doubled.

also look into sort() and reverse()

e.g. newNumbers.sort(function(a, b){return a-b}).reverse(); Will sort the array and reverse its order.

You need this comparison thing in the sort() because of they way numbers are processed with sort()

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!