Hmm. Something is not working. It does not seem to be looping to the next i as I think it should.

```
**Your code so far**
```

```
function smallestCommons(arr) {
let min=Math.min(...arr);
let max=Math.max(...arr);
let maxFact=1;
let flag=1;
let scm=0;
for (let j=min; j<=max; j++){
maxFact*=j;
}
for (let i=max; i<=maxFact; i++){
for (let k=max; k>=min; k--){
flag=1;//SCM until it isn't
if (i % k != 0){//if the k element of the range leaves a remainder for i
flag=0;
break;//Not SCM. should leave K with flag=0 until it gets to SCM
}
}//it should only leave k loop with flag=1 when it is at SCM
console.log(scm, i, flag);
if (flag==1) {//if it has found an i without any remainders.
let scm=i;
break;
}//otherwise next i.
}
return scm;
}
smallestCommons([1,5]);
```

P.S. I just revised this swapping in a == for a =

```
**Your browser information:**
```

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

**Challenge:** Intermediate Algorithm Scripting - Smallest Common Multiple

**Link to the challenge:**