From a02b29e1d5022be88179ae58bfe9551d72b8bd4b Mon Sep 17 00:00:00 2001 From: Rohan Gupta <56235204+rohan9896@users.noreply.github.com> Date: Sat, 28 May 2022 18:24:21 +0530 Subject: [PATCH] Create Fraz_recursion_1.js --- Recursion/Lecture 1/Fraz_recursion_1.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Recursion/Lecture 1/Fraz_recursion_1.js diff --git a/Recursion/Lecture 1/Fraz_recursion_1.js b/Recursion/Lecture 1/Fraz_recursion_1.js new file mode 100644 index 0000000..b330a66 --- /dev/null +++ b/Recursion/Lecture 1/Fraz_recursion_1.js @@ -0,0 +1,12 @@ +function fact(n){ + + if(n < 0) { + return 'Error'; + } + + if(n === 0) { + return 1; + } + + return n * fact(n-1); +}