I had quite a bit of trouble with this challenge and I’ve been going through the solutions to see how they all work. I can’t figure out how reduce is used in the GCD/LCM solution (code below).

With the reduce method being called on range, I just don’t know how it ends up returning the LCM of all the numbers in the range.

If anyone can provide a quick explanation I would really appreciate it. Thanks!

```
function smallestCommons(arr) {
// Setup
const [min, max] = arr.sort((a, b) => a - b);
const range = Array(max - min + 1)
.fill(0)
.map((_, i) => i + min);
// GCD of two numbers
// https://en.wikipedia.org/wiki/Greatest_common_divisor#Euclid's_algorithm
const gcd = (a, b) => (b === 0) ? a : gcd(b, a % b);
// LCM of two numbers
// https://en.wikipedia.org/wiki/Least_common_multiple#Using_the_greatest_common_divisor
const lcm = (a, b) => a * b / gcd(a, b);
// LCM of multiple numbers
// https://en.wikipedia.org/wiki/Least_common_multiple#Other
return range.reduce((multiple, curr) => lcm(multiple, curr));
}
smallestCommons([1, 5]);
```