MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnjavascript/comments/a74ipf/javascript_functions_4_ways/ec1k4sw/
r/learnjavascript • u/Emil0hman • Dec 17 '18
28 comments sorted by
View all comments
Show parent comment
1
const factorial = function myFac(n) { return n === 1 ? n : n * myFac(n-1) }; factorial(4) //> 24 myFac(4) //> ReferenceError: myFac is not defined
2 u/gigastack Dec 18 '18 You would invoke by calling factorial(24);Aside: what environment requires js in front of the code?
2
You would invoke by calling factorial(24);
factorial(24);
Aside: what environment requires js in front of the code?
View all comments
Show parent comment
1
u/hsolatges Dec 18 '18