<!DOCTYPE html>
<html leng = 'en'>
<head>
<meta charset = 'UTF-8'/>
</head>
<body>
<script>
var arr = [[],[],[],[],[],[],[],[],[],[]]
for(var i = 0; i < 10; i++){
for(var j = 0; j < i + 1; j++){
if(j === 0 || j === i){
arr[i][j] = 1;
}else{
arr[i][j] = arr[i - 1][j - 1] + arr[i - 1][j];
}
}
}
console.log(arr);
</script>
</body>
</html>
js écrit le triangle de Yang Hui (tableau à deux dimensions)
Je suppose que tu aimes
Origine blog.csdn.net/weixin_48727085/article/details/107727449
conseillé
Classement