Re:PracticeJS – Coding exercises in a mobile friendly web app
by stevewodil on Saturday June 08, 2019 @06:43PM
(#20135699)
Not sure what the test cases are for the Fibonacci sequence (just happened to pick that one first), but it gives an error for my code, and I'm not able to figure out why. (please ignore my bad variable names)
[ Parent
| on HN ]
Re:PracticeJS – Coding exercises in a mobile friendly web app
by viceroyalbean on Saturday June 08, 2019 @06:51PM
(#20135741)
Your function will return 2 for index = 4, whereas it's expecting 3.
Re:PracticeJS – Coding exercises in a mobile friendly web app
by stevewodil on Saturday June 08, 2019 @11:13PM
(#20136858)
Then are the instructions not clear enough, or am I just missing something....
From the website: "For example, the sequence [0, 1, 1, 2, 3, 5, 8, 13, 21, 34] forms the first ten entries of the Fibonacci sequence." Entering 4 should return 2 in this case, which is correct? I don't get it.
Re:PracticeJS – Coding exercises in a mobile friendly web app
by fwip on Sunday June 09, 2019 @01:38AM
(#20137342)
Index 4 is the fifth element, 3. Index 0 is the first element (a zero).
Reread the examples.
Re:PracticeJS – Coding exercises in a mobile friendly web app
by stevewodil on Sunday June 09, 2019 @09:56AM
(#20139200)
Hmm...I see. Thank you for the help!