function rec(value) {
for (let i = 0; i < 2; i++) {
console.log("start " + value);
if (value <= 0) return;
rec(--value);
console.log('end');
}
}
rec(3)
start 3
start 2
start 1
start 0
end
start 0
end
start 1
start 0
end
end
start 2
start 1
start 0
end
start 0
end