# Pls tell me if why my code is not correct

**URL:** <https://forum.freecodecamp.org/t/pls-tell-me-if-why-my-code-is-not-correct/464818>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [June 14, 2021, 6:14am UTC](https://forum.freecodecamp.org/t/pls-tell-me-if-why-my-code-is-not-correct/464818 "2021-06-14T06:14:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CodingBaby](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/codingbaby/32/221446_2.png) [@CodingBaby](https://forum.freecodecamp.org/u/CodingBaby)\
**Post date:** [June 14, 2021, 6:14am UTC](https://forum.freecodecamp.org/t/pls-tell-me-if-why-my-code-is-not-correct/464818/1 "2021-06-14T06:14:26Z")

</div>

**Tell us what’s happening:**  
Describe your issue in detail here.

```
  **Your code so far**

```

```js

var count = 0;

function cc(card) {
// Only change code below this line

if (card >= 2 && card <= 6){
  count+1;
} else if (card == 10 || card == 'J' || card == 'Q' || card == 'K'|| card == 'A') { 
  count - 1;
  }else {
    count + 0;
  }
  if (count > 0){
    return count + "Bet";
  } else if (count < 0){
    return count + "Hold"
  }

// Only change code above this line
}

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; rv:89.0) Gecko/20100101 Firefox/89.0`

**Challenge:** Counting Cards

**Link to the challenge:**

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/counting-cards)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![lasjorg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lasjorg/32/280761_2.png) [@lasjorg](https://forum.freecodecamp.org/u/lasjorg)\
**Post date:** [June 14, 2021, 6:40am UTC](https://forum.freecodecamp.org/t/pls-tell-me-if-why-my-code-is-not-correct/464818/2 "2021-06-14T06:40:04Z")

</div>

1. You are not assigning the result of `count + 1` and `count - 1`. You need to assign the result of the opration. Also, `count + 0` is a no-op, it doesn’t do anything (at least not as long as `count` is a number).

2. `else if (count < 0)` what about when `count` is `0`?

3. Remember the space in the return.

---

<div class="post-metadata">

**Author:** ![CodingBaby](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/codingbaby/32/221446_2.png) [@CodingBaby](https://forum.freecodecamp.org/u/CodingBaby)\
**Post date:** [June 16, 2021, 12:02pm UTC](https://forum.freecodecamp.org/t/pls-tell-me-if-why-my-code-is-not-correct/464818/3 "2021-06-16T12:02:35Z")

</div>

thanks man i completed the challenge

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [December 16, 2021, 12:03am UTC](https://forum.freecodecamp.org/t/pls-tell-me-if-why-my-code-is-not-correct/464818/4 "2021-12-16T00:03:19Z")

</div>

Closed on December 16, 2021, 12:03am UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
