Smallest Common Multiple, what is answer?

I have problem becouse i dont’ uderstood answer.
why my answer is bad ? someone help me understands excercise?

[1,5] why is 60 not 5 or 10 ?..

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

function smallestCommons(arr) {
  let min = (arr[0] > arr[1]) ? arr[1] : arr[0];

// while loop
while (true) {
    if (min % arr[0] == 0 && min % arr[1] == 0) {
        console.log(min);
        break;
    }
    min++;
}
console.log(min);
}


smallestCommons([5,1]);


smallestCommons([5,1]);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0.

Challenge: Smallest Common Multiple

Link to the challenge:

Hello!
The reason [1,5] = 60 is because 60 is the smallest number which can be divided by 1, 2, 3, 4 and 5 and still remain an integer.

So for example, 5 is not a multiple of 2, 3 or 4, and 10 is not a multiple of 3 or 4.
Does that make sense?

I think @AndreasGuldborg explained it pretty well, but in case you would like to read more on it, and have a calculator to test around with, you may find this link helpful:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.