FCC Challenge: Smallest Common Multiple

developer tool shows my code as correct. but fcc console doesnt accept my solution.

function smallestCommons(arr) {
  let nums=[];
  for(let i=arr[0];i<=arr[1];i++){
  let ctr=0;
  for(let i=nums[0];true;i++){
    for(let j in nums){
    if(ctr==nums.length){return i;}   


What do the failing tests say? Is your code running too slowly?

You never want to do this because a) it’s an indication that your code will be super slow, b) it is an indication that you’re using the wrong type of loop.

Could you please edit your title to be something meaningful?

Hi. I understand. I need to think of a new approach to the problem. Also, what is the “correct” type of loop if I were to pursue this kind of approach?

I have edited the title as well.

For this problem, a while loop or a for...in loop are good fits.