Https://www.codecademy.com/en/courses/introduction-to-javascript/0/2#


#1

//Here is an example of a strawberry index
var index = 20;

//Boolean value rotten
var rotten = false;
var strawberries = 500
//If the index is divisible by five, the strawberry is rotten, so set
//rotten to true. False, otherwise
if (strawberries % 5 === index ) {
rotten = (true);
} else {
rotten = (false);
}
whats wrong with this code guys?


#2

Even though the code seems fine, you must tell us what kind of warning/error message is getting displayed and the url link to the exercise.

So far the answer (rotten) is being false due to the if statement.


#3

Dude, it’s not the code that has a problem, it’s your math.


#4

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