Hey, thanks for the detailed solution. I understand the exercise much better now.

One thing that confuses me is that you seem to be using the variable 'sheepToRemove' for two different purposes, both to describe the number of sheep to remove in months divisible by four and in months when the number of sheep exceed 10000. Am I missing something about loops here? Does javascript pick up the variable where it leaves off on the first loop when it begins the second?

Sorry if my question is worded poorly, these are all new concepts to me.

Hi! Same variable, Luke, and it at a certain level represents the same thing.

I don't think most devs would get that detailed, where it servers the same purpose but in different parts of the code, at least not in this case, but the idea of having 1 variable do 1 thing in general is great!

Well, I haven't looked through all of the comments but I think your coding area may not like my naming convention. It keeps saying that the 'goneSheep' is not defined. I am only using it in the 'if' statement and I also thought you could declare it there.By the way, I missed where the use of three '=' i.e. '===' means something. Can you help me with this?

The percent sign works out the remainder of monthNumber / 4. When monthNumber == 4, 8 or 12 the remainder is 0. The other month numbers will all return a remainder when divided by 4.

wildheartMedia:

What's the difference beween the above and monthNumber /4 == 0?

My maths isn't the best either, but I think monthNumber / 4 would only ever equal 0 if monthNumber == 0.

wildheartMedia:

numSheep *= 4;

Does this mean numSheep multiplied by 4?Could this be written numSheep = numSheep*4?

Yes, this could be written as numSheep = numSheep*4. numSheep *= 4 is just a short way of writing it.

wildheartMedia:

Is there a resource, cheatsheet or reference you can recommend to learn this kind of syntax? I'm assuming there'll be a lot more of this kind of thing coming...

I'm sure all of this syntax is referenced somewhere in the course material, but I can't lay my hand on it at the moment. The MDN website is a great resource for JavaScript reference material. Specifically the following pages can help you with this kind of syntax:

When applying the work it tells me : "The first time there are more than 10000 sheep, you should log the message 'Removing 8192 sheep from the population.'"

But my output is : There will be 16 sheep after 1 month(s)!There will be 64 sheep after 2 month(s)!There will be 256 sheep after 3 month(s)!Removing 192 sheep from the population.There will be 256 sheep after 4 month(s)!There will be 1024 sheep after 5 month(s)!Removing 512 sheep from the population.There will be 2048 sheep after 6 month(s)!Removing 1024 sheep from the population.There will be 4096 sheep after 7 month(s)!Removing 3072 sheep from the population.There will be 4096 sheep after 8 month(s)!Removing 2048 sheep from the population.There will be 8192 sheep after 9 month(s)!Removing 4096 sheep from the population.There will be 16384 sheep after 10 month(s)!Removing 8192 sheep from the population.There will be 32768 sheep after 11 month(s)!Removing 24576 sheep from the population.There will be 32768 sheep after 12 month(s)!

Just want to reiterate that "find 75%" is a very confusing way to write that out. At first I thought it meant remove 25%. Got it when I just removed 75%. ex. (numSheep *= .25%) Loops and conditionals are already pretty hard for a lay-person, especially if this is one of their first languages. Please just write "remove 75%".

Hello! Really, really close. The error message says you should be printing out a much larger number in the first remove statement, so that was my clue. I checked the else if, and you just missed a zero, and should instead have

It used to be more open-ended, but that caused even more confusion, as people didn't even figure it out or know what to ask or where to begin.

Anyway, it says

find 75%

because you don't want to remove it right away (under a fairly straight-forward solution), you just want to log it out, and then later says

Then, remove that value

Not sure how to best fix it, but there are obvously some problems. Completing simplifying or removing this challenge is on the table, and if resources permit that may be done (it is a beginner course, so to me it's okay to just simplify).

Ah, that does make a little more sense. I have some experience with VB and Java, so I understand conditionals for the most part. The problems with the sheep are probably the hardest in this section of the "Javascript RoadTrip." That being said they were good for actually coding, so I'm a little hesitant to push for removing them altogether. It's good to have something that's really challenging and takes more than three steps to figure out. I'm not sure how a complete novice would feel about them though. Thanks for the feedback!

Once again the examples in the videos and slides are completely different to the challenges. The video examples basically compare 2 values using >= then the challenge throw in a huge curve ball, which if you were coming to this without having had any previous experience of Javascript, the only way to complete the task is to view these boards.

No where in the video examples, have you explained how to find a percentage of a variable.

I get the impression that because the videos have been filmed you can't go back and change them, yet you're constantly updating the callenges. I think you're going the wrong way about it. Make the videos more informative and cover all the bases you plan to test in the challenge.

I can't figure out why mine didn't work, my console was outputting the exact responses that it was looking for, but it kept telling me "Incorrect Submission: The 4th time through, you should cut the numSheep by 4 (divide it by 4), and log the amount of sheep that were removed. You may need to do some math to calculate how many sheep were removed. You should log the message Removing 192 sheep from the population." Which my log did say.

I tried here to solve the "if" statement without declaring a variable by simply performing an operation on numSheep, which I could tell by the output solve the "else if" statement correctly.

I could not understand why a variable must be declared and then subtracted from numSheep in the "if" statement because I knew from my outputs that the "else if" statement worked correctly without declaring a variable. The outputted math around my "if" statements was obviously wrong despite generating the correct statement for number of sheep removed.

In the "if" statement, you must declare a new variable for the number of sheep to remove and subtract it from the total number of sheep rather than perform an operation on numSheep, because performing the operation numSheep *= .75 gives you the number of sheep you must remove, not the remainder that is multiplied for the total number of sheep in month 4. However, you do not need to declare a variable and subtract in your "else if" statement because performing the operation numSheep /= 2 or numSheep *= .5 gives you both the number of sheep to be removed (half of the total) and the number of sheep remaining (half of the total) to be multiplied for the total number of sheep in the next month. This was very confusing to me and I only understood the solution in coming here to ask the question. If any value other than "half" was used for cases in which the total number of sheep is >10000 then you would need to create a variable and subtract it from numSheep after printing your "remove" statement.