Been studying and working on coding for about 3 months now, finished the free courses on HTML, CSS and JavaScript in Codecademy and now I’m here.Sailed through the HTML and CSS portions here at freeCodeCamp, but now I feel like I’m getting stuck a lot in JavaScript, mostly just the challenges like the “Convert Celsius to Fahrenheit”, “Stand in Line”, and most recently “Counting Cards”. I figure them out mostly on my own but, get really stuck on simple things that I should already know for example here’s my code for “Counting Cards”:
var count = 0;
function cc(card) {
// Only change code below this line
var decision;
switch (card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count = count + 1;
break;
case 7:
case 8:
case 9:
count = count + 0;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count = count - 1;
break;
} if (count > 0) {
decision = "Bet";
} else {
decision = "Hold";
}
return (count + " " + decision);
// Only change code above this line
}
First of all I created an unnecessary variable called “decision”, I did not use the shorter cleaner versions of count++;, and also added the 7, 8, 9 cases which weren’t needed, Not only this but, I didn’t even figure out the code myself I had to get help from someone to hint to me that I needed to return a concatenated string because I kept returning an array. [count, decision];
If I can’t figure out simple stuff like this, how am I going to become a professional and make this my career? I know this isn’t even the tip of the iceberg either, haven’t even gotten to the algorithm challenges yet…should I just move on to something else and not waste my time?