Problem 5: Smallest multiple

Tell us what’s happening:
Looks like my logic can’t find the smallest multiple and end up in an infinite loop. Can someone point me to the right direction please?

Passing all the tests except the last one.

Your code so far

function smallestMult(n) {
  // Good luck!
  let isFound = false;
  let currNumber = 0;

  while(!isFound) {
    // Add itself if it's not divisible
    currNumber += n;

    for(let i=n; i>=1; i--) {
      // if currNumber is not divisible by numbers in range, break out of forloop
      if(currNumber % i !== 0) {
      // currNumber is divisible by all numbers down to 1!
        isFound = true;

  return currNumber;


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:

Well, from what I can tell, your code runs. The issue is that it’s not coming out with the correct answer.

Can you do it by hand? If not, here’s what helped me to understand the problem.