I'm a noob why doesn't this work?

var count = 0;

function cc(card) {

  // Only change code below this line

var cardValue1 = [2,3,4,5,6];

var cardValue2 = [10,'K','J','Q','A'];


function lowCard(cardValue1) {

  count1 = card + 1;



function highCard(cardValue2){

  count2 = card - 1;


count = count1 + count2

  return count;

  // Only change code above this line


cc(2); cc(3); cc(7); cc('K'); cc('A');
1 Like

Hello for starters it seems you havent defined count 1; i.e using let or var

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

count1 is not defined, the freeCodeCamp editor uses strict mode, that means you need to declare all your variables.

Second, count should just be raised by one or lowered by one depending on the card, you insteat use the card value as a way to determine the value of count