This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the most basic factorial | |
function fact1(n){ | |
if(n < 2) return 1; | |
return n*fact1(n-1); | |
} | |
// let's add some precondition verifications | |
function fact2(n){ | |
if(typeof n !== 'number' || isNaN(n) || n < 0) |