Skip to content

Instantly share code, notes, and snippets.

@yschen25
Created April 6, 2022 23:24

Revisions

  1. yschen25 created this gist Apr 6, 2022.
    6 changes: 6 additions & 0 deletions Recursion - example 3
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    function factorial(n) {

    if (n === 0) return 1;
    return n * factorial(n - 1);

    }