Boolean for three odds?

Unclear as to why it’s not passing. It is telling me:

`````` 1) threeOdds returns true if there are at least 3 odd whole numbers between the numbers given:

AssertionError: expected false to deeply equal true
+ expected - actual

``````

Instructions:

``````Write a function named threeOdds that takes 2 numbers and returns true if there are at least 3 odd numbers between those two numbers

Example:

If you pass 0,2 it should return false because the only number between 0 and 2 is 1
If you pass 0,6 it should return true because between 0 and six (the numbers 1,2,3,4,5) there are three odds - 1, 3 and 5
``````

My code:

``````function threeOdds(num, num2) {
let count = 0;

for (let i = num; i < num2.length; i++) {
if (num % 2 !== 0) {
count++;
}
}

if (count >= 3) {
return true;
} else {
return false;
}
};
``````

I think you wanted to get the remainder of `i`, not `num` in the for-loop. Also isn’t `num2` supposed to be a number? So shouldn’t it be just `i < num2`?

1 Like

Yeah, of course. Must be tired at this point.