# Covering losses issue

#1

Hi,

I’m doing the problem at https://www.codecademy.com/en/courses/introduction-to-javascript/0/5

I complete the problem and my answer is the same as the Help says (earnings = 157.5) but instead of accepting my answer, it says

“Oops, try again. Are you using a for loop to iterate through 10 strawberries?”

Although I obviously have : see my code below.

``````
//To make up the money you lost from picking rotten strawberries,
//you decide to pick 10 extra strawberries everyday for the next
//7 days.

var earnings = 0;

//Fill in the outer loop with an inner loop that loops through
//10 strawberries and increment your earnings by 2.25 for every
//extra strawberry that you pick

for (var days = 7; days > 0; days--)
{
for(var strawberries = 1; strawberries<11; strawberries ++)
{
earnings += 2.25;
}
}
console.log(earnings);

//Boolean that returns true if your losses have been covered
var lossesCovered = true;

//Write an if statement that changes the lossesCovered to true
//if the earnings are greater than or equal to 225

if(earnings>=225)
{lossesCovered=true}
else
{lossesCovered = false}
``````

#2

the course you take is no longer supported, so bugs might exist

if we look at the validation:

``````if (code.indexOf("< 10") < 0 &&
code.indexOf("> 10") < 0 &&
code.indexOf("<10") < 0 &&
code.indexOf(">10") < 0 &&
code.indexOf("=10") < 0 &&
code.indexOf("= 10") < 0)
return "Are you using a for loop to iterate through "
+ "10 strawberries?";
``````

we see that 10 is required in the loop condition, you use 11

#3

So it is indeed a small bug. I have replaced 11 by 10 as you suggested (and therefore 1 by 0 to get the same count) and it worked.

Out of curiosity, what else is no longer supported ?

#4

the old learning environment is longer supported, the one which you are currently using:

the new learning environment looks different:

here is the JS course in new learning environment: