From 487d0f8f748b179e69fd8797aed5a9df918da0f1 Mon Sep 17 00:00:00 2001 From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com> Date: Wed, 24 Nov 2021 21:01:05 +0530 Subject: [PATCH] Exercise 6.7 --- Chapter 6/Exercise 6.7 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Chapter 6/Exercise 6.7 diff --git a/Chapter 6/Exercise 6.7 b/Chapter 6/Exercise 6.7 new file mode 100644 index 0000000..b6247c5 --- /dev/null +++ b/Chapter 6/Exercise 6.7 @@ -0,0 +1,18 @@ +let start = 10; +function loop1(val) { + console.log(val); + if (val < 1) { + return + } + return loop1(val - 1); +} +loop1(start); +function loop2(val) { + console.log(val); + if (val > 0) { + val--; + return loop2(val); + } + return; +} +loop2(start);