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

119
Views
how I return smallest three numbers from the first array to new array?

let years = [1, 4, 2, 7, 3, 9, 5];
let k = 3; // new array of three the smallest nums from the first array

function removedIntegers(arr) {
  let sortedArr = arr.sort();
  let j = [];
  for (let i = 0; i < sortedArr.length; i++) {
    if (sortedArr[i] != sortedArr[i + 1]) {
      return Element.years > k;
      //   j.push(sortedArr[i]);
    }
  }
  return j;
}

console.log(removedIntegers(years))

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

let years = [1, 4, 2, 7, 3, 9, 5];

function removedIntegers(arr) {
  let sortedArr = arr.sort().slice(0,3);
  console.log(sortedArr)
}

about 4 years ago · Santiago Trujillo 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!