r/learnjavascript • u/WishGranted11 • 13d ago
Javascript is interesting but is also driving me nuts, how do you actually adapt to writing code without mistakes quickly?
I have been accustomed to C# and Python and have only recently been introduced to one of our projects where we use JS (express and react). I can write good code that eventually happens to work, but I keep falling for really unexpected pitfalls. I realized that most of my mistakes were calling undeclared variables, they are mostly errors that can almost never happen in python or C# because the compiler would immediately point to that piece of code and will usually prevent the app from running. That honestly took a good amount of time and a lot of energy. I understand that it's a regular part of learning, though I want to speed it up.
I know that the browser can ignore these issues so the app ends up running without realizing a problem. Also, that debugging part where console.log() is the best tool in our hand is a headache, it helps but I feel that being able to set breakpoints and move through the whole piece where a bug hides is more efficient.
Don't get me wrong, I am not hating on JS, I love it and I acknowledge that each programming language holds its advantages over other languages. I have in fact spent a good amount of time and put a lot of effort into understanding how to handle JS and react (not a lot but to an extent where I understand its rules and syntax, and can build with it). That's why I want to see how others who may have adapted to JS avoid making these rookie mistakes over and over.
Do not mention asking AI to fix issues or write code instead. I prefer to write code myself.
View all comments
Show parent comment
1
u/Beginning-Seat5221 12d ago
What advantages have been put forward for using JavaScript?
I know there was some talk of Svelte moving away from TS to using JSDocs - but I think they were still type checking and I'm not sure what else what doing to type checking but typescript.
Other than that?
As I said earlier, you can use typescript in loose mode, where plain JavaScript will compile, if you really want to, and you can run your .ts files directly in any runtime, so it's really hard to see what advantage pure JS can have.