I had a similar thought process for this problem, but couldn’t figure how to write it up until I saw his code (I was trying to use a while loop in the for loop, etc what a mess).
I will break it down how I understood it using smallestCommons ([1,3])
So the min = 1 & max = 3
He has set his variable mltple equal to max (or 3 in this case)
The for loop is created to go 3 --> 2 --> 1 then break
The if statement condition essentially says that the remainder of mltple divided by i does not equal 0 and if that is true then execute the below code which is max is added to mltple and i is reset to max (or 3). If the if statement is false, where the remainder does = 0, then you will decrease i by 1 and run through the loop again.
So starting with i = 3
3 % 3 !== 0 is false --> move to i =2
3 % 2 !== 0 is true --> 3 + 3, i = 3
6 % 3 !==0 is false --> move to i =2
6 % 2 !==0 is false --> move to i = 1
6 % 1 !==0 is false --> for loop breaks because of initial condition
then the code says to return mltple, which is 6 at the time of the for loop breaking.
As you can see, 6 is divisible by all the numbers in the range of 1 to 3. This is why you have to work incrementally from greatest to smallest.
Hope that helps!