Tell us what’s happening:
As far as I get the lesson
This is what I must do
If one of the numbers are
[ 2, 3, 4, 5, 6 ] + 1
[ 7, 8, 9 ] + 0
[ 10, J, Q, K, A ] - 1
They also need a card parameter
and a count variable
I revieuwd this: JavaScript else Statement
and: JavaScript Comparison Operators
Your code so far
var count = 0;
function cc(card) {
// Only change code below this line
if (card == 2, 3, 4, 5, 6) {
count = +1;
}
else if (card == 7, 8, 9) {
count = +0;
}
else (card == 10, 'J', 'Q', 'K', 'A') {
count = -1;
}
// Only change code above this line
}
// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.2 Safari/605.1.15.
Challenge: Counting Cards
Link to the challenge: