Basic JavaScript: (Counting Cards)

Tell us what’s happening:

please i need assistance i dont know what am not getting right....

Your code so far

var count = 0;
function cc(card) {
// Only change code below this line
switch(case) {
  case 2:
  case 3:
  case 4:
  case 5:
  case 6:
  case 10:
  case "J":
  case "Q":
  case "K":
  case "A":
if (count > 0) { 
  return count = 'Bet'

  return count + " "+ " Hold";
// Only change code above this line

console.log cc(2); cc(3); cc(7); cc('K'); cc('A');

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36.

Challenge: Counting Cards

Link to the challenge: text

Hello @ijay!

Taking a look at your code, there are a few places that need to be edited for the exercise tests to pass.

  1. Your switch case has case as its argument, which won’t connect to anything. You need to change that value so that the right argument is inserted into the switch statement.

  2. Your statement for the “bet” output is not currently correct, as it will convert count from a number to “bet.” That needs to be changed as well.

  3. The console is probably not letting you test the code you’ve written because of the console.log you’ve added at the bottom. console.log is a function call, and therefore needs an argument inside parenthesis to work.


For cases where you want to log multiple items, you can separate the parameters with commas or write multiple console.log statements.

console.log(test1(), test2());

Hope this helps!