Smallest Common Multiple: won't pass the last test case

Tell us what’s happening:
Hay, guys, I’ve stumbled upon this problem. It passes all the tests, except the last one for some reason: smallestCommons([23, 18]) should return 6056820.
It works in browser console though :woozy_face:

Your code so far


function smallestCommons(arr) {
  const sortedArr = arr.sort((a, b) => a - b)
  const dividersArr = createDividersArr(sortedArr[0], sortedArr[1])
  let smallestCommonNumber;
  for (let i = 0; !smallestCommonNumber; i++) {
    smallestCommonNumber = isDividedByAllNumInArr(dividersArr, i) ? i : undefined
  }
  return smallestCommonNumber
}

function createDividersArr(min, max) {
  const arr = []
  for (let i = min; i <= max; i++) {
    arr.push(i)
  }
  return arr
}

function isDividedByAllNumInArr(arr, num) {
  return arr.every(el => {
    return num % el === 0
  })
}

smallestCommons([23, 18])


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple/

To protect you from accidentally crashing your browser with an infinite loop or infinite recursion, FCC will stop running your code if it is taking too long. Unfortunately, it is possible for a less efficient solution to be mistaken for an infinite loop.