Is it possible that I am too stupid to learn this?

Tell us what’s happening:

Even while following the answers I can’t seem to write the code properly and I am getting quite overwhelmed. I reach brick walls easily, and I am too afraid to ask anybody I know personally because they tend to get frustrated at my lack of understanding. I am starting to get the idea that I am too stupid to learn how to program or do any kind of complex mathematics or algorithm, but am also unable to accept this fact, as if that were the case I really do not see the point in living. At any rate I imagine I will learn a lot slower than the next guy, which is really starting to depress me. So I am leaving this vent here, in the hope that sleep will clear my head of these negative thoughts and I can return to work with a more positive outlook.

Your code so far


var count = 0;

function cc(card) {
// Only change code below this line
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
break;

case 10:
case "J":
case "Q":
case "K":
case "A":
Count--;
break;

}
if (count > 0){
return count + "Bet";
}else{
return count + "Hold"

}







return "Change Me";
// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
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/80.0.3987.122 Safari/537.36.

Challenge: Counting Cards

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/counting-cards

I don’t get there yet, but listen me: Be kind and gentle with yourself, please.

Everyone faces up any sort of difficulty with all sort of challenges. Don’t compare either with someone else without fully their personal challenges.

I wish you the best on getting the help for the desired outcome.

2 Likes

Ask any questions you have here. As long as you are listening and trying, we won’t get frustrated. There are people here who have each spent hundreds of hours talking things through with novice programmers.

Learning slowly is fine, just please don’t lash out at those of us trying to help you. If I can be blunt, saying things like “I really don’t see the point in living” gives the impression that you might be prone to melodramatic outbursts. That will make me give up on helping you long before being a slow learner will.

1 Like

Let me answer your question. One word, NO.

I saw this when I was looking for something else; and I signed up just so I could respond to you. You said: “I am starting to get the idea that I am too stupid to learn how to program or do any kind of complex mathematics or algorithm” THEN you said exactly what I tell myself anytime I come across something that I want to do, but I can not seem to grasp in the beginning. You said: “am also unable to accept this fact”!
I said to myself, this guy is going to make it. You see, like you, We are just to darn stupid /stubborn to think that there is anything we can not do as long as we put our mind to it. I also will attest to this: programmers do not have to be mathematician. You keep pushing and keep that attitude that you will not accept failure. You will make it.

2 Likes

you are not stupid, you are impatient. Time and effort.

for your code, you are doing wonderfully. You need to be more careful with the small stuff: count and Count are two different variables (and Count doesn’t exist in your code)
and spaces matter

try using console.log(cc(5)) (or any other function call) at the end of your code to see what is printed to the console

2 Likes

Thanks for the honest feedback, everybody! I was mostly just venting my end-of-day frustrations, and the silly voice in my head, while making the first post of my journey to this respectable community.
I think if I am ever hopelessly stuck at the end of a session maybe it would be a good idea to post the problem I am having here, while also trying to figure it out myself away from the computer, before I begin the next session again with a clear mind.
Thanks again.
It really was a silly little error, and not my first to encounter I am sure :upside_down_face:

2 Likes

Javascript is hard. For a lot of people it can take years to fully understand.

You can do this, be post questions. Code tends to all look the same after a few hours and a lot of us go to bed. You’d surprised how much easier many coding problems are after a nap.

1 Like

Been programming for 30+ years myself, and more than half my bugs are just silly little things I missed somewhere, not about getting the concept wrong. Have a stress ball handy, or a punching bag (preferably not a living one) when you program. You’ll use it a lot :woozy_face: :boxing_glove:

1 Like