function factorial(num) {
    // TERMINATION
    if (num < 0) {
        return;
    }

    // BASE
    if (num === 0) {
        return 1;
    }

    // RECURSION
    return num * factorial(num - 1);
}
// rewriting the above function using recursion
rewriting the above function using recursion
rewriting the above function using recursion
function factorial(num) {
    if (num < 0) {
        return;
    }
    if (num === 0) {
        return 1;
    }
    return num * factorial(num - 1);
}
function factorial ( num ) { if ( num < 0 ) { return ; } if ( num === 0 ) { return 1 ; } return num * factorial ( num - 1 ) ; }
rewriting the above function using recursion
rewriting the above function using recursion
// TERMINATION // BASE // RECURSION