Why my code does not pass the tests?

i’m begginer to javascript, but it works on my pc, what is wrong ?

  **Your code so far**

function smallestMult(n) {

let numbersToDivide = []

for (let i = 1; i <= n; i++) { //pushes every number from 1 to N in the array
  
  numbersToDivide.push(i)
}


var i = 0

do {
  i++
} while (numbersToDivide.every((num) => i % num == 0) == false);


return i

}

console.log(smallestMult(20))

  **Your browser information:**

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

Challenge: Problem 5: Smallest multiple

Link to the challenge:

It looks like you accidentally created your post before you were finished asking your question. You can edit your post to tell us what is going on and how we can help.

i have edited it thanks

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