Sum All Odd Fibonacci Numbers while question

I’m trying to wrap my head how this while loop is working. Any input is apreaciated. Thank you

  **Your code so far**
function sumFibs(num) {
var currNum = 1
var prevNum = 1
var ab = currNum + prevNum
var sum =2
while(ab <= num){
 ab= currNum + prevNum
return sum

  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Sum All Odd Fibonacci Numbers

Link to the challenge:

Watch it run.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.