JavaScript Challenge, not sure how to fix this

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

   **Your code so far**

let count = 0;

function cc(card) {
 // Only change code below this line
if (card > 1 && card < 7){
 count++ } 
else if (card = 10, card = 'J', card = 'Q', card = 'K', card = 'A') {
else (card = 7, card = 8, card = 9); {
  count ;

if (count > 0) {
 return (count + ' ' + 'Bet')
 else (count >= 0); {
   return (count + ' ' + 'Hold')
 return "Change Me";
 // 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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36

Challenge: Counting Cards

Link to the challenge:

Welcome to the forum ^^
Next time please try describing your issue, as communicating about code is vital in programming.

As for this… well maybe look at the code and notice all the inconsistencies.
Like how the if-condition uses && but then the else-if suddenly uses , or how the else-block doesn’t contain any meaningful code.

Then ofcourse we have the second if-else where you are checking if a number that isn’t bigger than zero, is bigger-or-equal to zero, as if somehow any number other than 0 could achieve that… and you finish it off with a return "Change Me" which looks like something you should have changed/removed.

In other word, please read you code again and fix logic-errors you produced. After that, read the task again and try to implement it. Keep the code clean and consistent - if it’s not working, ask again for help. As it stands now, it gives off the impression you gave up halfway through.

1 Like

And is card = 10 and the rest of your equal signs doing what you think they should be doing?

1 Like

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