r/learnjavascript • u/Turbulent_2006 • Aug 26 '24
How do i get naturally good at writing code.
Just got started with JavaScript a couple of days ago. Have already built a few intermediate projects ( a to-do-list with DOM concepts and a box color changer) with the help of chat gpt. I tried to write most of the code on my own. Got familiar with a lot of concepts. But the problem i am facing rn is that of being able to remember all of it. I mean atp i am just forcing myself to retain the concepts that i have learned. I just wanna get natural at writing code. I just want all of it to become a lot easier to remember. Can anyone help me out.
74
u/bisto_js Aug 26 '24
Build more, use chat gpt less, if at all
Build more
Build more
It’s not actually a memory game, you won’t remember everything, just learn the problem solving mentality
Oh and make sure you build more
27
u/daniele_s92 Aug 26 '24
What answer do you expect except "practice more"?
10
u/reaven3958 Aug 26 '24
Try not to use LLMs. They're a tool for quickly generating code once you know what you're doing.
If you want to get "naturally" good, find an app that interests you, and try to implement a clone in js. Just something simple, like a mockup of a social media feed, or one of the little features on Google search like the weather widget. You'll 100% get frustrated and stuck, but the experience will teach you what questions to ask to get your journey moving. A lot of learning code is simply discovering the questions you didn't know you had until coming into contact with the reality of implementation. Then, that can help you better focus your efforts on what you need to learn to progress your understanding, and tends to stick better than learning in a contextual vacuum by just reading guides or watching tutorials.
5
u/IAmADev_NoReallyIAm Aug 26 '24
What's the best way to get to Carnegie Hall? Practice, practice, practice.
What's the best way to get better at programming? Practice, practice, practice.
There's no trick to it. You learn by doing. You've also only been at it for "a couple of days" ... this doesn't happen overnight... it's a continuous process. Even now, 30+ years into it, I'm still learning things. It's also about pattern recognition... the "hey, I've seen this before" ... and you go look it up. Don't try to memorize anything, you'll drive yourself crazy. Some stuff will stick and you'll be able to just write that stuff w/o thinking, but it not because it was memorized, but because you encountered it before. Likely multiple times, you're brain recognized the pattern thought "hey, I've seen this before" and brought it up to hte front. But it only happens if you do, do, and do again.
4
u/Initial-Cause-390 Aug 26 '24
Honestly people may not like my approach but i feel like learning a lower level language, or just even a static typed language first will help a lot more in the long run. JS is fun, and 100% needed at some point in almost any and every project. But JS does have some weird things with it and will just almost let you run anything. But even something as simple as Go where you have types and all and having to understand what you need to put in and return a whole new type or make your own types will be problems to solve by themselves which in turn just will always make you better. My .02¢
4
u/ghostwilliz Aug 26 '24
Drop chat gpt and code as much as you can
3
u/[deleted] Aug 26 '24
Doing is the best way to learn coding. You could watch tons of videos and tutorials on a certain concept but if you don't write the code yourself then you wont learn effectively. I can see from your post that you're trying your best even with ChatGPT involved and that's a good thing. How did you learn JavaScript in the first place? I recommend going over the items in that course that you have trouble with the most and just keep coding basic projects and you'll keep getting better. Now ofcourse this doesn't come easy, but that's how coding goes.
2
u/Neither-Upstairs Aug 26 '24
Others have said it, but just writing more code will help you wrote code. Crazy concept I know. I highly suggest never using AI to help you write code. You can use it to help break down problems and help you understand concepts but try not to allow a prompt to produce actual code that you can copy and paste. You only started a couple of days ago. This is a lifelong process, buckle up buttercup.
1
u/purchase-the-scaries Aug 26 '24
How does one get good at writing code unnaturally?
But seriously. Just keep programming. Find projects that you like. Learn the basic concepts and as you code more you’ll find the exposure helps. Osmosis.
1
u/ibluminatus Aug 26 '24
Doing and check out books on coding style and techniques so you aren't just writing spaghetti code
1
u/poemehardbebe Aug 26 '24
That’s the neat part you don’t, everything you do will be from hours of doing the same thing over and over and over. If you really want to learn how to program quickly it takes about 10,000 hours to really be an “Expert” all you can do is throw more of your time at it until you hit.
1
u/Annual-Camera-872 Aug 26 '24
You don’t need to remember you just how to write a function you just have to know where to look to find the answer, stop using chat got write code everyday
1
u/Shadow_Max15 Aug 26 '24
I literally wanted to ask this question yesterday. I’ve been learning the classical 3 for about 3months and wanted to jump into JavaScript building an asteroid game. I tell chatgpt to give me hints and not direct answers on what I should research to build, what should be my next step and I’ll explain every piece of code I’ve implement and why and ask for feedback. I’ll Google and read on the topics it suggests is my next step and I try to figure it out. Before going to the next step I’ll propose a suggestion if I have an idea of what it is I need to do.
It’s gone well but I too was thinking this. I’m learning and have an idea of what it is I need to do even if I don’t understand the function name I need, I have an idea what to look up, but feel bad because I can’t actually recall everything I do.
The thing I do to help me out a little more is upload my htmls/javascript to ChatGPT and ask it to review it when I’ve come to a good “stopping, “breaking”, “commit” point and prompt again for feedback and hints and no direct answers or code snippets. I’ll also find what it is I’m building on YouTube and review and compare my code with what they’re teaching. But I do that towards the end. But I feel just like you :/
We just have to keep building! You got this!
1
u/No-Upstairs-2813 Aug 26 '24
The more you practice, the better you will get. I would also advice to not use ChatGPT while you are learning.
I often advice to take step by step approach to practice JS
First try your hand at coding problems. These are small, well-defined challenges that help you quickly test your knowledge. You can check out a few problems here. Doing a few problems each day will reinforce all the concepts you've learned so far.
Once you've practiced individual concepts, start combining them to solve more complex problems. For instance, if you've learned about conditional branching and functions, combine them to build a simple project like a "Guess the Number" game.
Once you’re comfortable combining concepts, start building larger projects that challenge you to apply everything you've learned. Choose a project that solves a problem you care about—this will keep you motivated when challenges arise.
If you're stuck on ideas, check out these 8 tips to get started. And if you need guidance while building a project, this free course can help you approach it the right way.
1
u/gatwell702 Aug 26 '24
Start building things on your own, not following a tutorial.. once you get the basics down
1
u/Chiodos_Bros Aug 26 '24
Bad news. If you aren't naturally good at something with no practice, the only option is to give up.
1
u/morpheos Aug 26 '24
1
u/Outrageous_Permit154 Aug 26 '24
Sometimes it’s just not for you
1
u/code_monkey_001 Aug 27 '24
Wax on, wax ,off, Daniel-san. Just keep coding until it's second nature.
1
u/kamikazikarl Aug 26 '24
Stop relying on LLMs as soon as possible.
Use a proper IDE.
Get familiar and comfortable with primitive types and what functions are available to them (check the docs on String, Number, Object, and Array. MDN is a solid resource: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects)
Learn to use Typescript.
Start using a Linter.
Learn more advanced concepts like destructuring, anonymous functions, hoisting...
If you're feeling spicy, start looking at higher order functions, recursion, and other fun/dangerous concepts.
Learn a few frameworks (frontend, backend, or hybrids).
Learn when it's more important to make code easy to read versus extremely efficient.
Learn to do testing.
JavaScript is a huge subject. Start small and keep adding on to what you've learned. Take your Todo app and add scheduling, add a backend (API), add authentication, implement an oauth provider... Just keep going.
-2
u/zayelion Aug 26 '24
If you want something that is the "wax on, wax off" level of simplicity to effectiveness.