Writing JS code

I have no problem understanding JS code, I can explain a block of code bit by bit, what it does, and what each line means but I have a huge problem when writing the actual code. For instance, I can explain the code to a challenge but cannot come up with the code if given the challenge. What do you guys do in such situations?

1 Like

Hello @stephenmutheu
Would it help if I remind you that we all learned to speak way before we even knew how to associate those sounds that we made with our mouth and put them into words that we could write down?
That’s just a thought!

1 Like

Write down in words what the problem is, without any reference to code.

Then break it down into smaller pieces. Once there are enough details, start writing basic code to solve each problem.

I give myself mini projects to do. More often than I like I google how to do things, skim read articles, just to get an idea when I hit a hurdle.

Spending just an hour every few days writing code, debugging, and testing is enough for me to develop conceptual skills. As the experts on this forum suggest, practice, practice, practice.

1 Like

You are understanding the code, you know how to use it, that’s the most important thing. Syntax and even languages will be less and less important with code snippets and AI assistants available 24/7.

I’m your super nerd, sometimes coding 60+ hours a week, but I’ll be damned if you ask me to write a Python function out of memory without referring to my sources. I also don’t know why to waste time and brain capacity by memorizing syntax.

I know where to look, what to ask, what the function is supposed to do, how to optimize and deploy the result. That’s where we should focus our skills as developers.

1 Like

I recommend you do what you do with every other thing you want to get good at. Just do it! Open up your editor and start typing, it may not be the response you are looking for but you should just do it.

Take some 1 or half hour, just typing out the syntax you already are familiar with, that way, when you pick up another challenging task, your fingers know the first things to do…and watch the domino magic effect.

This is me here. The advice I got was to keep practicing. Regular practice of building actual features here and there helps us become more comfortable using it. Maybe not every line of code but some will become familiar enough to write ourselves due to repetition.

1 Like

It is OK to fail as long as you try.

Coding is pretty much just failing your way to success.

1 Like

Yes, there’s even a whole discipline to coding based on it: Test Driven Development.

I’m new here Stephen and at the same time I’m new to writing programing can you pls put me through where to start from?

I thank you all for the insights. I’ll make sure to adhere.

1 Like

“First try” is a meme in coding for a reason, because we rarely get things right the first time. We fail and try until it works. Then we test it some more and find new bugs. So we try again until the code (to the best of our knowledge) works as intended. Debugging code is part of the coding process for this reason.

Failing your way to success just means trying until it works and is a reflection of the fact that your code often will not work “first try”.

1 Like

I left an answer in the other post. If you need something, please, open a new dedicated thread for it, in that way we do not interfere with the original poster request.

1 Like

First of, Freecodecamp is your goldmine. Explore, ask questions, etc here. That said, I think it depends of where you feel like you will excel at. So you don’t waste time because whichever track you decide on, you need to commit and be consistent asap. If you were to be in BACKEND, I suggest starting with learning ‘how to program’, Programming helps you understand the fundamentals because whatever language out there all have similar approaches, maybe the difference is in syntax. Then move on to Projects. Start building PROJECTS and get comfortable.

As already mentioned, create a new post for this, so you can get others to contribute and you can chart your way from there.

1 Like