diff --git a/Chapter 12/recursive functions b/Chapter 12/recursive functions new file mode 100644 index 0000000..afee069 --- /dev/null +++ b/Chapter 12/recursive functions @@ -0,0 +1,19 @@ +let start = 100; +loop(start); +loop1(start); +function loop(val) { + console.log(val); + if (val < 1) { + return + } + loop(val - 1); +} + +function loop1(val) { + console.log(val); + if (val > 0) { + val--; + loop1(val); + } + return 'end'; +}