How to solve tricky problem

Tell us what’s happening:
hi~!
i am not able to solve this problem please don’t tell me the soln i wan tto try it by my own but i want to ask here what ways can i opt to solve problems like this ???

Your code so far


var count = 0;

function cc(card) {
 // Only change code below this line
if(card > 1 || card < 7) {
 return "5 Bet";
} else  if(card > 6 || card < 10) {
  return "0 Hold";
} else if(card ) {

} else if(card) {
  count += 2;

}
}
console.log(cc(2));
console.log(cc(7, 8, 9));

Your browser information:

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

Challenge: Counting Cards

Link to the challenge:

What do you think these else if conditions are checking?

do you mean Boolean???

Hello,

try to solve that problem STEP BY STEP as expected!

In your solution:
You have to use:

  1. && instead of ||"
  2. in your ‘if’ and ‘else’ you have to increment or decrement the cards. For example ‘card += 1’
  3. At the end of the code you return the result. Here you also use ‘if’ and ‘else’ because you have to decide between two cases.
    As a result I prefer to use for example
`${count} Hold` 
`....`

is not the same as ‘…’ or “…”]

I hope it helps a little!

1 Like