Abundant, deficient and perfect number classifications: debugging/optimize

Abundant, deficient and perfect number classifications: debugging/optimize
0

#1

Tell us what’s happening:
need some help debugging my solution…not sure where I’m going wrong. I feel like it probably needs to be optimized

Your code so far


function getDPA (num) {
  let deficient = 0
  let perfect = 0
  let abundant = 0 

  function classifier(n){
    let divSum = 0
    for (let i = 1; i < n; i++){
      if (n%i===0){
        divSum += i 
      }
    }
    return divSum
  }

  for (let i = 1; i <= num; i++){
    if (classifier(i) < i){
      deficient++
    } else if (classifier(i) === i){
      perfect++
    } else {
      abundant++
    }
  }

  return [deficient, perfect, abundant]

}

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/coding-interview-prep/rosetta-code/abundant-deficient-and-perfect-number-classifications/