Smallest Common Multiple: Test bug?

Smallest Common Multiple: Test bug?
0

#1

Tell us what’s happening:

All my tests pass in console, including the ones the FCC test suite shows are not passing.

Your code so far


function smallestCommons(arr) {
  
  let num = 1; 
  while(!divisible(list(arr), num)) {num++}
  return num;
}

//list maker
function list (input) {
  let listArray = [];

    if (input[0] <= input[1]){
    let element = input[0];
    while (element <= input[1]){ 
      listArray.push(element);
      element++; 
    }
    }

    if (input[0] >= input[1]){
    let element = input[1];
    while (element <= input[0]){
      
      listArray.push(element);
      element++; 
    }
    }
  return listArray
}

//check if multiple 
function divisible (someArray, someNum) {
	for (let i in someArray){
		if (!(someNum % someArray[i] == 0)){
		 return false}
    }
	return true 
}



smallestCommons([1,5]);

Your browser information:

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

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


#2

Your solution is too slow which means you will use a more efficient algorithm to solve this challenge. Your slower solution is triggering FCC’s infinite loop protection, even though you do not have an infinite solution.