2.2 KiB
2.2 KiB
id | title | isRequired | challengeType | videoUrl | localeTitle |
---|---|---|---|---|---|
a302f7aae1aa3152a5b413bc | Factorialize a Number | true | 5 | Factorialize عدد |
Description
n!
على سبيل المثال: 5! = 1 * 2 * 3 * 4 * 5 = 120
فقط تزويد الأعداد الصحيحة التي تزيد عن أو تساوي الصفر بالوظيفة. تذكر استخدام Read-Search-Ask إذا واجهتك مشكلة. اكتب الكود الخاص بك. Instructions
Tests
tests:
- text: يجب أن يعيد <code>factorialize(5)</code> رقمًا.
testString: 'assert(typeof factorialize(5) === "number", "<code>factorialize(5)</code> should return a number.");'
- text: يجب أن يعيد <code>factorialize(5)</code> 120.
testString: 'assert(factorialize(5) === 120, "<code>factorialize(5)</code> should return 120.");'
- text: يجب أن يعيد التجهيز <code>factorialize(10)</code> 3628800.
testString: 'assert(factorialize(10) === 3628800, "<code>factorialize(10)</code> should return 3628800.");'
- text: يجب أن تعيد إنتاجية <code>factorialize(20)</code> 2432902008176640000.
testString: 'assert(factorialize(20) === 2432902008176640000, "<code>factorialize(20)</code> should return 2432902008176640000.");'
- text: يجب أن يعيد <code>factorialize(0)</code> 1.
testString: 'assert(factorialize(0) === 1, "<code>factorialize(0)</code> should return 1.");'
Challenge Seed
function factorialize(num) {
return num;
}
factorialize(5);
Solution
// solution required