JavaScript Challenge - Prime Number Finder

This is my solution.
First I create a function to check if it is prime or no.
So, I aply this function in any number.

function primeFinder(n) {
  // Write your code here
  const prime_list = []
  function check(number){
    if(number < 2){
      return false
    }
    for (let i = 2; i < number; i++) {
      if (number%i === 0){
        return false
      }
    }
    return true
  }
  for (let i = 0; i <= n; i++) {
      if (check(i)){
        prime_list.push(i)
      }
    }
  return prime_list
}
console.log(primeFinder(11))

// Leave this so we can test your code:
module.exports = primeFinder;