Smallest Common Multiple help with while loop

Tell us what’s happening:
Hello, am I understanding while loop right that if the if statement inside my for loop is met, then it will break the loop but the value of x will remain and so the loop will begin again at arr[0] while x’s value is now x + 1 from the previous where it did the break? am I understanding how while loop works?
so if the value of x is let’s say 6, the statement will reset and go back to x++ making it 7 now?

arr = [5, 4, 3];
let flag = true;
let x = 0;
while (flag){
for loop {
if (x % arr[index] != 0){
else if (x is divisible to all arr[index]){
flag = false;

Your code so far

function smallestCommons(arr) {
  return arr;


Your browser information:

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

Link to the challenge:

What does this do? There is no such JS as “for loop”. See if you can get some working code and then check back. If you are unsure what is happening, try putting some console.log statements in to track what is happening.