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

92
Views
function not passing arguments object test

I'm currently completing an assignment where I need to pass the following test

* should work on an arguments object

Here is my code.

function first (array, n) {
  var result = [];
  if (Array.isArray(array)) {
    if (n && n > 0) {
      var number = n > array.length ? array.length : n;
      for (var i=0; i < number; i++) {
        result.push(array[i]);
      }
    } else {
      result.push(array[0]);
    }
    return result;
  } else {
    return result;
  }
};

Im not sure what lines I need to ammend to make it pass this test, can anyone help me?

about 4 years ago · Juan Pablo Isaza
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!