Flip a Coin Again explainer


#23

Take a look at Heather’s response to Spacegras above.

–Frankie


#24


What’s wrong with this . Am i doing any mistake ? It not submitting further but shows with this blue mark .


#25

The puzzle is looking for if (answer === 'heads'), which is a bit picky because your code will still draw 2 different pictures depending on whether the answer is heads or tails. It might make sense to make this change though, because your pictures will draw a green “T” shape if the answer is heads and an orange “H” shape if the answer is tails, which seems backwards.

–Frankie


#26

Yeah! Done ! Your answer helped me :grin::v:️very much thanks


#27

Screenshot_2018-08-12-13-36-45-88 not getting correct


#28

Your 2nd If Statement if ('heads' === 'tails') will always be false, so it will never run the code inside its block {}.

Try making it check if the answer is equal to 'tails' by using if (answer === 'tails')

–Frankie


#29

We need to use same Colors for both heads and tails


#30

No, you can draw any pattern you want and use any colors.

–Frankie


#31

I tried this in the playground but it didnt work


#32

The playground won’t have any blue feedback hints or show the completion, but you should be able to recreate the code.

–Frankie


#33

I can’t figure out what I am doing wrong :frowning:


#34

Since there are only 2 possibilities for the value of answer, you only need 1 If-Else Statement.

Your 2nd If-Else will work on its own except this puzzle is a bit strict about testing for 'heads'. Try resetting the puzzle and then inserting drawBoxes('any string you want') inside the else {...} block.

–Frankie


#35

It worked! Thank you :smile:


#36

Would it be possible if you explain to me where am I wrong with details my English is not fluent at all


#37

Your code will give the correct output, but it can be simplified. We know there are only 2 choices for answer: 'heads' or 'tails'. That means if answer is not 'heads', it must be 'tails'.

Inside the else {...}, we don’t need another if (answer === 'tails') because that test will always be true.

If you remove the 2nd If Statement and just have drawBoxes('...'), that should complete the puzzle.

–Frankie