{"id":155000,"student_id":10,"content":"//迴圈版本\nfunction fib (day) {\n var a = 1;\n var b = 1;\n \n for (var i = 3; i \u003c= day; i++) {\n var tmp = a + b;\n a = b;\n b = tmp;\n }\n return b;\n}\n\n//遞迴版本\nfunction fib (day) {\n if (day \u003e 2) {\n return fib(day - 1) + fib(day - 2);\n } else {\n return 1; //也可以直接 return 不用寫 else \n }\n}\n\n//測試\nfunction test (day, answer) {\n var result = fib(day);\n console.log(`根據程式算出,第 ${day} 月有 ${result} 隻兔子 ${answer == result ? '答對了😃':'答錯了😡'}`);\n}\n\ntest(1, 1);\ntest(2, 1);\ntest(3, 2);\ntest(4, 3);\ntest(5, 5);\ntest(6, 8);\n\n","created_at":"2020-06-03T13:37:32.293+08:00","updated_at":"2020-06-03T18:15:24.046+08:00","name":"費氏數列(預設版)","language":"javascript","screenshot":{"url":"/uploads/project/screenshot/155000/fd1ac05835b665cf0d7e3c5532c7c2d7.jpg"},"parent_id":154695,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":396,"hashid":"2pds86wd","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[]
Orange Apple Learning Platform
My Projects
View Project Page
Export
Remix
Import
Delete
Download Android APP (APK)
Screenshot
繁中
简中
English
日本語
1:1:1
1:1
Full Width
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer