Flip a Coin Again explainer


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



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


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.



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


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


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')



We need to use same Colors for both heads and tails


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



I tried this in the playground but it didnt work


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



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


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.



It worked! Thank you :smile:


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


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.