← Back to challenges

Evaluating Factorials

JavaScriptHardstringsformattingmatharrays

Instructions

Create a function that takes an array of factorial expressions and returns their sum.

Examples

evalFactorial(["2!", "3!"]) ➞ 8

evalFactorial(["5!", "4!", "2!"]) ➞ 146

evalFactorial(["0!", "1!"]) ➞ 2

Notes

0! and 1! both equal 1.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Amazing Alliteration