Why aren't I mastering JavaScript like I did Scheme, Haskell, and Python in university class?

Similar to how error messages looked like a foreign language until I was taught how to read them, I think my current challenge with JavaScript is because of something I’m doing wrong.

I’m confused about when I should use an if-else statement instead of a switch statement. Also, I didn’t use function declaration in either of the two projects. Is it like var in that I’m usually better off using arrow functions and it was mainly taught to me so that I would recognize it if I’m working with old code? However, var specifically mentioned that I’m usually better off using let or const, and function declaration didn’t say that in the lesson.

In my previous university-level class, I would get a problem statement and figure out how to solve the problem based off of that and the occasional hint. In the Codecademy projects, I often have to look at the hints and/or see how the developer does at least the beginning of each step in order to solve them. While my first instinct was that that’s because I do way less practice of the concepts at Codecademy than my past class. When I looked at the coding challenges and portfolio projects, I saw that I hadn’t even completed the prerequisite to the Javascript class I needed to complete to do any of them. Because of that, I think that I need the increased hand holding for a different reason.

How could I understand things like when to use if-else statement or switch statements? How can I reduce the amount of handholding? Are there any resources you could point me to? Thank you!

Not sure if it’s relevant, but I’m about to start learning scope in JavaScript Syntax, Part I.

There is no ‘should’ in this decision. It’s a choice. My recommendation is to always set up your code using if..else unless the exercise specifically instructs us to use a switch.

Consider a comparison of switch cases to a JavaScript object (key-value pairs). See a similarity? Maybe not yet, but when you get to objects, do this comparison. You will discover why I keep telling people to use an object to do the heavy lifting instead of using a switch. Yes, there is some learning curve to this but it is not rocket science. It is not far down the road in your learning path.

As for arrow functions, I’m old school and still recommend using function expressions over arrow function expressions for code that has multiple statements.

const foo = function (bar) {
    return bar;

The above is concise enough to warrant an arrow function.

const foo = bar => bar;

If it is not concise, then stick to function syntax.

var is the legacy declaration keyword and it is still valid. Do we need to use it? Well, rarely, and only with purpose in mind, so generally speaking you can forget about it till somewhere down the road. We’ve discussed some of the technical differences but at this stage none of that matters. Devote yourself to const for functions, arrays and objects, and constant values (persistent), otherwise use let if there is a chance the variable will be updated during the session.

At the very beginning stages, such as where you are currently, it may be better to just go along with the lessons and exercises and reserve some questions for later. Perhaps the answers will surface before the question is even asked. Go with the flow, follow instructions explicitly and make your way through the Learn JavaScript track from end to end. You can skip the projects and go back later to complete them. Focus on keywords, syntax, control flow, logic and general usage of loops, variables and objects. Let all other concerns have a back seat for the time being.


Thank you mtf for your advice clarifying when to use if…else, switch statements, arrow functions and function declarations. While I think I understand why you recommended I skip the projects and only do the lessons and quizzes until I finish the JavaScript classes, I’d appreciate it if you confirm my reflection is correct. Thank you.

What I like about practicing my coding through stuff like projects is otherwise, I’ll continue with knowledge gaps. Knowledge gaps could lead to struggling to understand advanced concepts and making incorrect assumptions. However, practicing my coding takes time and constantly practicing my coding after each concept will take more time than dealing with the disadvantages of incomplete understanding. Additionally, advanced concepts will fill in at least some of the knowledge gaps. For example, I could have learned you can define a variable in the body of a function through the lesson on scope. I can fix the incorrect assumptions the same way as my knowledge gaps, by practicing my coding.


Everyone learns differently, so there are no hard and fast rules, especially in a mooc environment that is self-driven. We have seen a great many questions in the forums relating to projects that introduce code or concepts that were not taught in the previous lessons. The reason I suggest holding off on projects is because the time is better spent completing lessons and doing the extra readings (docs) and practicing with the newly learned concepts in a test bed such as REPL.it. The idea is to be comfortable going into a project, and to be able to ideate the steps as suggested in the instructions. There is very little thinking going on if we are struggling in a knowledge vacuum.