Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1b19a54

Browse files
Created functions.js
1 parent 3a427d2 commit 1b19a54

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

‎10 Days of Javascript/functions.js‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Create the function factorial here
3+
*/
4+
function factorial(num){
5+
if(num==1){
6+
return 1;
7+
}
8+
else{
9+
var fact= 1;
10+
for(var i=num; i>1; i--){
11+
fact= fact*i;
12+
}
13+
return fact;
14+
}
15+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /