findDivisorsByPairingSorted = number => {
  const divisorsLessThanSqrt = [];
  const divisorsMoreThanSqrt = [];

  const sqrt = Math.sqrt(number);
  for (let i = 1; i <= sqrt; i++) {
    if (number % i === 0) {
      divisorsLessThanSqrt.push(i);
      if (i !== sqrt) {
        divisorsMoreThanSqrt.unshift(number / i);
      }
    }
  }

  return divisorsLessThanSqrt.concat(divisorsMoreThanSqrt);
}
Find all the divisors of a natural number
This solution has a cost of O(sqrt(n))
This method returns the array in a sorted manner
All divisors of a number are present in pairs
(divisorLessThanSqrt, divisorGreaterThanSqrt)
Reverse the divisorGreaterThanSqrt array and append to divisorLessThanSqrt
to sort the result
Eg : For n=16: (1, 16), (2, 8), (4, 4).
Include only one of the repeated divisors if any

@param {number}
@returns {number[]} - returns the divisors