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

106
Views
Factorial push to array

I'm making a factorial. How do I push specific number to an array? For example if we factor a 14 then the result will be 1, 2, 7, 14 then I only want to push 2 and 7 to the array. Another example is if we factor 18, then the values that I want to push is only 2, 3, 6, 9. I want to exclude the 1 * 14 or 1 * 18. How can I do that?

const isNFactored = function(value, number) {
    let i;
    let array = [];
    for(i = 1; i <= value; i++) {
        if(value % i === 0) {
            array.push(i);
        }
    }
    
    console.log(array);
}
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!