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

223
Views
How to write a test case for a function which gets another function as argument?
const remove = (arr) => {
    return arr.splice(1 , 2);
}
const removeElement = (func , arr) => {
      return func(arr)
}
console.log(removeElement(remove , [1,2,3,4,5]));

In the above code I am passing remove function to removeElement function as an argument how can I write a test case for removeElement function? I don't want to write the entire remove function inside the test file.

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!