freecodecamp counting cards exercise issue

I know how to solve this issue with simple switch statements. However, I would like to solve it using arrays and if/else statements. I seem to only get 0 hold for all of my inputs.

Instructions for exercise

var count = 0;
var arr = [[2,3,4,5,6],[7,8,9],[10,'J','Q','K','A']]
var answer = "";
function cc(card) {
  // Only change code below this line
  if (card == arr[0]){
    count ++;
    answer = count + " " + "Bet"
  }else if(arr[1]){
    answer = count + " " + "Hold"
  }else{
    count --;
    answer = count + " " + "Hold"
  }


  return answer;
  // Only change code above this line
}

163 thoughts on “freecodecamp counting cards exercise issue”

  1. Pingback: stromectol 6 uses

Leave a Comment