Gm5,
или так ...
<script>
function Freindly(min, max) {
const arr = [];
let e;
for (let i = min; i <= max; i++) {
let a = getSum(i), b = getSum(a);
if(i === b && i != a && (e = !e)) arr.push([i, a])
}
return arr
}
function getSum(num) {
let end = num/2,
sum = 0;
for (let i = 1; i <= end; i++) {
if (num % i === 0) sum += i;
}
return sum;
}
let x = Freindly(1, 9000);
document.write(JSON.stringify(x))
</script>