Smallest Common Multiple assertion issue

Tell us what’s happening:
Hi there

I get the same result as the test result when I run the code in the console, however my answer is not accepted as correct by the assert system


Your code so far

function smallestCommons(arr) {
  let max = (arr[0] > arr[1]) ? arr[0] : arr[1];
  let min = (arr[0] < arr[1]) ? arr[0] : arr[1];
  let scm = max;
  let finished = false;
  let factor = 1;
  while (!finished) {
    finished = true;
    scm = max * factor;
    factor += 1;
    for (let i = min; i<max;i++) {
      if (scm % i != 0) finished = false;
  return scm;


Your browser information:

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

Link to the challenge:

1 Like

Thanks Ariel.
I’ll consider it solved and continue :slight_smile:

Keep in mind that all FCC challenges can be solved with an efficient algorithm. You just need to use a more efficient one than you are currently.

1 Like

Thanks @RandellDawson I’ll try