n!
表示n!
例如: 5! = 1 * 2 * 3 * 4 * 5 = 120
只有大于或等于零的整数才会被提供给该函数。如果卡住,请记得使用Read-Search-Ask 。编写自己的代码。 factorialize(5)
应该返回一个数字。
testString: 'assert(typeof factorialize(5) === "number", "factorialize(5)
should return a number.");'
- text: factorialize(5)
应该返回120。
testString: 'assert(factorialize(5) === 120, "factorialize(5)
should return 120.");'
- text: factorialize(10)
应返回3628800。
testString: 'assert(factorialize(10) === 3628800, "factorialize(10)
should return 3628800.");'
- text: factorialize(20)
应该返回2432902008176640000。
testString: 'assert(factorialize(20) === 2432902008176640000, "factorialize(20)
should return 2432902008176640000.");'
- text: factorialize(0)
应该返回1。
testString: 'assert(factorialize(0) === 1, "factorialize(0)
should return 1.");'
```