<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
function fun(num) {
console.log(num)
if (num == 0 || num == 1) {
return 1;
}
return fun(num - 2) + fun(num - 1)
}
fun(5);
// 輸出結果為
// 5
// 3
// 1
// 2
// 0
// 1
// 4
// 2
// 0
// 1
// 3
// 1
// 2
// 0
// 1
</script>
</body>
</html>

