From d428b31b7ccc572b760ba05635ba820344150595 Mon Sep 17 00:00:00 2001 From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com> Date: Wed, 24 Nov 2021 21:00:24 +0530 Subject: [PATCH] Exercise 6.6 --- Chapter 6/Exercise 6.6 | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Chapter 6/Exercise 6.6 diff --git a/Chapter 6/Exercise 6.6 b/Chapter 6/Exercise 6.6 new file mode 100644 index 0000000..c891f33 --- /dev/null +++ b/Chapter 6/Exercise 6.6 @@ -0,0 +1,10 @@ +function calcFactorial(nr) { + console.log(nr); + if (nr === 0) { + return 1; + } + else { + return nr * calcFactorial(--nr); + } +} +console.log(calcFactorial(4));