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/delventhalz 12d ago
Honestly, if you are using TypeScript in loose mode, I question why you are bothering with it at all. TS is awesome when it can offer you rock-solid guarantees. When you leave gaps in those guarantees you are adding whole build step for what... better autocomplete? Doesn't seem worth it to me.
Anyway, yes the Svelte team and Turbo 8 team have both famously written about their transition away from TypeScript recently. If you want the details, I recommend you look up what they've written themselves. As you might expect, the reasons mostly boil down to complexity, both in terms of adding to the build process and adding to the mental load of developers. I probably wouldn't have made the same decision myself for Svelte or Turbo 8. For projects and teams of that size and complexity, I think the trade offs are worth it. But as the teams and projects gets smaller, I am more and more sympathetic to just keeping things simple.
Tools have to carry their weight to convince me to deal with them. TypeScript often does, but if I'm just throwing together a portfolio page or a small web app or something, no I'm not bothering.