Smallest Common Multiple Final Condition seems to be incorrect

Tell us what’s happening:

Your code so far

function smallestCommons(arr) {
  var orderedArr = arr.sort();
  var arrNum = [];
  var smallestCommonMultiple = 0;
  for(var i = orderedArr[0]; i <= orderedArr[arr.length-1]; i++){
  var biggestCommonMultiple = arrNum.reduce(function(a,b){
    return a*b;
  for(var k = 0; k < arrNum.length; k++){
    for(var j = 1;j<=biggestCommonMultiple; j++){
      smallestCommonMultiple = j;


Your browser information:

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

Link to the challenge:

Hi everyone,
I think I was doing everything correctly until the last step which seems to be multiplying all the numbers in the given range and then it gives me the result(obviously, an incorrect one). I wonder how should I change this last condition in order to make it work nicely?

Thanks in advance.

The last one is not console.log but return, of course.

Your algorithm is not efficient enough which causes it to take longer than the FCC test system will allow (around 100ms). Basically, the script stops executing at some point which is why the strange numbers for the last couple of tests. In general your algorithm is incorrect, because smallestCommons([1, 5]) should return 60 and your function returns 120.