Counting Cards Example Output Misleading
See original GitHub issueIn the Basic JavaScript section of the Front End Development Certification, the directions for the Counting Cards challenge show the following Example Output:
"-3 Hold"
"5 Bet"
Since previous challenges deal with escaping characters such as the double quote, I thought the solution required double quotes around the result as depicted in the Example Output. After spending some time troubleshooting my code, I discovered that the expected answer is one without quotes. For example:
-3 Hold
5 Bet
In order to avoid confusion, I think the Example Output should not include double quotes around the output. It misleads the coder into thinking that double quotes should be a part of the output when the accepted answer is not expecting them.
As an alternative, the system could accept results that include quotes in the output.
Sample Code
if (count>0) return “"” + count + " Bet"“; //This code fails because it includes escaped double quotes if (count<=0) return count + " Hold”; //This code passes because it doesn’t include quotes
Challenge Name: Counting Cards
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (6 by maintainers)
Top GitHub Comments
I think the instructions are quite clear that
Bet
andHold
are themselves strings without needing the double quotes around them in the code format, so those can probably be removed. It would be useful to have some way of distinguishing different types in the instructions (eg without needing to use quotes to specify something is a string), but I’m not sure what form that would take.There is some inconsistency about string format in instructions, output, and test messages between various challenges and it would be great to have some unified style there to prevent confusion as seen in other issues similar to this one.
to solve quotation in answer just modify return statement to be like this
return (‘"’+count + " “+'Hold”');
use single quotes to define it is as a string and combine it with double quotes as an output with the string result