Weird bug with FCC Challenge

I was doing the Smallest Commun Multiple challenge and then I got this weird bug with my code. My code works just fine when I put it in the browser dev tool, but when I try to run from FCC page it always gives me random output, and I’m not allowed to finish the challenge because of that

here is my code

function smallestCommons(arr) {
  const minorLimit = Math.min(...arr)
  const majorLimit = Math.max(...arr)
  let num = majorLimit - 1
  let boolFlag = []
    boolFlag = []
    for(let i = minorLimit; i<= majorLimit; i++){
  return num;


the output, in this case supposed to be 6056820, but instead I just receive random values everytime I change anything on my code from FCC Page code runner.

One more thing: I tried to deactivate the infinity loop protection by writing ```` //noprotect ``` in the beginning of my code but unfortunately it still doesn’t worked

The algorithm you have chosen to use is not efficient enough and as a result triggers the infinite loop protection FCC current has. The //noprotect no longer works in the curriculum version. You need to rethink your loop logic to increase efficiency.