This commit is contained in:
asd
2021-06-03 10:52:41 +08:00
parent c5f18c6051
commit 907511778b
54 changed files with 3540 additions and 50 deletions

View File

@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
// 递归 就是在函数内 调用自身
// 阶乘的函数
// 5的阶乘 = 5*4*3*2*1
// n的阶乘 = n*n-1*(n-2)*(n-3)...*1
// n*(n-1)*(n-1-1)*(n-1-1-1)*(n-1-1-1-1)....*1
function jc(n){
if(n==1){
return 1;
}else{
return n*jc(n-1)
}
}
// 4
// 4*jc(4-1) 4*jc(3)
// 4*jc(3) 4*3*jc(3-1)
// 4*3*jc(2)
// 4*3*2*jc(2-1)
// 4*3*2*jc(1)
// 4*3*2*1
var jiecheng=jc
jc=null
var res=jiecheng(5)
console.log(res)
</script>
</head>
<body>
</body>
</html>