You can learn ternary operators and arrow functions. I feel that you may be overwhelmed because you're trying to learn so much at one time. I've been in your shoes. If you keep trying, you will improve. Something I've done in the past is to write down everything I don't understand, and just chip away at that list daily by reading documentation and learning new things. Don't try to learn them all in one day.
Seconding this. It’s easy to be overwhelmed by the seeming combinatorial complexity of things. Just start a little personal wiki (eg, arrow syntax, structural typing, etc) and it’ll help you decompose things into more easily understandable pieces (it’s easier to multiply 7x5x21x22 than to factor 16170, if that makes sense).
Ask HN: Help, I'm Drowning in JavaScript
21–30 of 56 posts
Re: Ask HN: Help, I'm Drowning in JavaScript
#22It looks like you’re lacking some fundamentals. And not if/else type of, but rather oop, software design and organization of code kind of things. What will help is to master a single decent beginners course that focuses on applying fundamentals to building practical projects. And it’s better to be python or ruby based course (to minimize friction and infra pain). Don’t jump on anything else until you finished and hav…
Are you suggesting a different technology stack for the fundamentals? Others seem to go the same way, but they are suggesting it within the ecosystem of JS, just not with the overhead of the new technologies.
Re: Ask HN: Help, I'm Drowning in JavaScript
#23I believe that's your main problem. You are seeing a foreign language kinda close to what you know and expect to understand it right away (while it's the same "Javascript", using different writing ways is more akin to another dialect). It takes a bit of time and practice to familiarize yourself with it. Try to decompose it until you become fluent. When you learned to read, you would read a word one letter at a time. Do the same: read the code one operator at a time, until you understand what's going on and how they work together.
For example, a ternary is just a compressed if/else with a different syntax. An arrow function is just an inline function with a different syntax. etc...
> I do not get Typescript
Typescript is Javascript with type safety. In Javascript, if you pass a number to something that expects a string, it will convert without any complaint. Typescript will complain that it's the wrong type. You can go much further than this with complex types that have to be passed correctly.
> thousands of dependencies, while nobody cares, that 20 to 100 of them are deprecated
Some people care, but for most dev, it's a black box that just works. It's frankly not something to worry about when starting.
> I do not understand, how this whole eco system works
If I had to sum it up, it would be building on the shoulders of giants, over and over again, at a break-neck speed, valuing improvements over backward-compatibility. I'm personally not a fan of it, but that's how it is.
Re: Ask HN: Help, I'm Drowning in JavaScript
#24You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML. As I have answered in HTML-and-regex questions here so many times before, the use of regex will not allow you to consume HTML. Regular expressions are a tool that is insufficiently sophisticated to understand the constructs employed by HTML. HTML is not a regular language and hence…
I can’t even parse that enough to decide if it should get an up or down vote and I haven’t even tried regex.
Re: Ask HN: Help, I'm Drowning in JavaScript
#25I don't know if I can offer any suggestions beyond just Googling syntax you don't understand and experimenting with it until you feel you understand it. From there it just a matter of time before you can glance your eye over the code and understand what it's doing without needing to decipher every line. I just want to say you're not alone. I think most frontend devs have gone through something similar at some point over the last decade - I know I have.
As for deprecated dependencies, that's a huge problem. Senior devs generally do care and will be selective around dependencies. One of the problems is that the ecosystem is evolving so quickly. Libraries come into and out of fashion almost over night so frequent maintenance is needed to keep dependencies up to date. My guess is that either devs are not putting enough thought into what dependencies they're using, or your not currently assigning enough time as a team to review & maintain your existing dependencies - this is definitely something worth raising with your team imo.
The last thing I'll say is that the use of ternary operators are something I'm very critical of and it's interesting that you mentioned them in your post. A lot of devs seem to have this mindset that if you can convert 5 lines of code to 1 or 2 that's always a good thing, but compressing 5 lines of code to 2 often comes at the cost of clarity and readability. It sounds like you might need to think about coding standards with your team. Is part of the problem here that the team is writing confusing / messy code, and it's that coupled with your lack of knowledge of modern JS that's resulting in the stress you're feeling here?
Re: Ask HN: Help, I'm Drowning in JavaScript
#26knowing the internal modules of nodejs such as fs, events, process, streams
knowing utility modules like lodash, asyncjs, rxjs
these could help.
but the fact is if your workmate is writing unreadable and unmaintainable code, hes the problem, not you.
you need linters, code conducts, test sequences, dependency upgrade schedules, node runtime update schedules, things like that.
i once left a high paying job because a colleague there is code golfing on our code. the team suffered more when i left lol.
in life choose your battles, dont stick with a shitty one. when applying for work, it is not just you applying for their company, it is you screening if their tech stack and coding practices is the right fit for you. screen hard.
Re: Ask HN: Help, I'm Drowning in JavaScript
#27> I do not understand his code I believe that's your main problem. You are seeing a foreign language kinda close to what you know and expect to understand it right away (while it's the same "Javascript", using different writing ways is more akin to another dialect). It takes a bit of time and practice to familiarize yourself with it. Try to decompose it until you become fluent. When you learned to read, you would rea…
Re: Ask HN: Help, I'm Drowning in JavaScript
#28knowing difference between es5 es6 es2017 es2018 and so on knowing the internal modules of nodejs such as fs, events, process, streams knowing utility modules like lodash, asyncjs, rxjs these could help. but the fact is if your workmate is writing unreadable and unmaintainable code, hes the problem, not you. you need linters, code conducts, test sequences, dependency upgrade schedules, node runtime update schedules,…
> but the fact is if your workmate is writing unreadable and unmaintainable code, hes the problem, not you.
That's a stretch, especially since OP also says:
> Or anyone elses.
Idiomatic new js/typescript is a completely different beast from old javascript. For all intents and purposes, it's a different language entirely. No one would be expected to pick it up in a minute. Sounds to me like this guy has decades old knowledge and doesn't know where to learn the new stuff, since the target is moving from one year to the next.
You yourself are suggesting today, that he learns libraries that are no longer necessary, like lodash.
Re: Ask HN: Help, I'm Drowning in JavaScript
#29Here's what I suggest:
1) Get the language basics really well.Like really well.
2) Move on to more complex concepts,again don't skim read, but do again and again and again.
3) learning from code written by a more experienced colleague may not be the best option. He may have a certain style, approach and etc. If you can't understand the code , you won't learn much from it.
4) Get yourself all ' you don't know JS' series and devour it. The books aren't easy read if you really try to understand the concepts but way better than some random guy on YouTube covering the subject in 2 min video.
5) I've recently did a private job with Regex,which I barely know. It was painful.. but it gets easier. Again, start with basics and build up, instead of trying to run complex queries and not fully understanding them.
6) Be methodical. Don't jump from one tutorial to another,from one book to another. Read one book,do all the exercises, only then move to something else.
P.S: Regexing HTML is by far the worst thing a dev could get to do, that's why most would advise against it. Don't be hard on yourself.
Good luck!
Re: Ask HN: Help, I'm Drowning in JavaScript
#30From day 0, a javascript project starts as a goal driven project of finishing things. Write hacky code for now we will figure them down the road. From that point on the hacks keep piling on top of hacks.
Another issue is "syntax overload". Javascript allows for doing one thing ten different way. So keep doing things your own way as long as you don't have to review other people's code. The new things JS brings out doesn't bring significant syntactical improvement and yet adds to the syntax overload syndrome.