var printRangeUpDown = function(min, max) {
if (min === max) {
console.log('condition met ' + min);
return
}
console.log('low to high ' + min);
printRangeUpDown(min + 1, max);
console.log('high to low ' + min);
};
printRangeUpDown(4, 10);
logs 4,5,6,7,8,9,10,9,8,7,6,5,4
Can someone explain why the console.log below printRangeUpDown makes it start logging backward? I understand that low will console log 4,5,6,7,8,9,10(base case) ... but I do not understand why console logging below the recursive makes it print 9,8,7,6,5,4 back to min