Live data from Hacker News

Ask HN: Help, I'm Drowning in JavaScript

news.ycombinator.com

41–50 of 56 posts

Re: Ask HN: Help, I'm Drowning in JavaScript

#41

Accept that your understanding of JavaScript is outdated. Appreciate you have at least some experience though. If you care to learn modern JavaScript, which you should, check out Eloquent JavaScript [0]. It’s a free web-based ebook providing an introduction to modern JavaScript. Also, stop with the negative narrative. You are overwhelmed, not helpless. Instead of telling yourself you don’t understand code and giving…

OP follow this advice, that's the best learning resource for modern JS.

The #1 thing you can do for yourself first though is accepting that what you learned 20 years ago probably means dick. JS has radically changed and that's OK. Go into this book with that mindset and you will come out a champ.

Re: Ask HN: Help, I'm Drowning in JavaScript

#42

Accept that your understanding of JavaScript is outdated. Appreciate you have at least some experience though. If you care to learn modern JavaScript, which you should, check out Eloquent JavaScript [0]. It’s a free web-based ebook providing an introduction to modern JavaScript. Also, stop with the negative narrative. You are overwhelmed, not helpless. Instead of telling yourself you don’t understand code and giving…

OP follow this advice, that's the best learning resource for modern JS. The #1 thing you can do for yourself first though is accepting that what you learned 20 years ago probably means dick. JS has radically changed and that's OK. Go into this book with that mindset and you will come out a champ.

After completion of Eloquent JavaScript and a decent comfort level with modern JS, is there an equally great resource to then transition into TypeScript?

Re: Ask HN: Help, I'm Drowning in JavaScript

#43
Never forget: The original version of Javascript was written in 10 days.

Javascript is a mess, especially at smaller shops which may face pressures to ship projects to a client that work, regardless of the state of the code.

Breathe. You're overwhelmed and that's ok. Just take it day at a time, line at a time and don't be afraid to have to google the same thing over and over again. It eventually sticks.

Don't be afraid to ask for help after you've exhausted yourself trying to solve something. Lots of other great advice in this post too. You'll get there.

Re: Ask HN: Help, I'm Drowning in JavaScript

#44

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.

Thanks, I just needed the hint to take a step back and reevaluate. Having a wiki is a good tip, I already have started to maintain a small database with snippets I use often. But it's just that. My next focus will be having a project which does not have to many features. Baby steps it is.

You can do it. It's normal to feel overwhelmed. I was in that position once but I really had no choice, I had to press forward or starve, so I eventually made it through.

Re: Ask HN: Help, I'm Drowning in JavaScript

#45
Oh, god, please stop abusing yourself. Stop using bad tools for the job of manipulating XML/JSON and start using a tool designed for the task: Saxon XSLT. It comes in Java, .Net, and JS forms.

https://www.saxonica.com/

XPath/XSLT3/Xquery are full-fledged functional programming languages that specialize in querying and transforming tree data structures. They make it so easy to work with XML and JSON. You don’t have to hurt yourself using the wrong tools!

Re: Ask HN: Help, I'm Drowning in JavaScript

#46

Earlier quoted context omitted.

Thanks for the kind words. Slowly going into the water is my approach as well, but sometimes it just gets to me. My learning projects die on the hill, because of the frustration I have on the job with these techniques. Plus, overwhelming ecosystem. About my regex problem: This is a structual mess. JSON/XML with HTML code in the data fields. We process them and send them to multiple job boards. Our clients mainly use…

I spent a decade parsing text-with-angle-brackets with regexes, and it sucks. It’s always tempting to try an html parser but if the code is written by a human (or worse, a mixture of human and machine, especially if the machine involves MS Word) it just doesn’t work. I’d suggest rather than attempting to do big regexes that capture a bunch of stuff in one call, break it down to a bunch of smaller, more targeted calls…

Essentially, this is what I do. First matching with a broader regex ruleset, working down to next one and so on and so forth. But with more complexity of code comes more breakage down the line. I went in full maze mode yesterday and questioned everything after thtat, so this is what my sanity looked like this morning.

Regex isn't really the problem though (even though it technically should also not be the solution in this case, but I cannot dictate the techstack). It was just the last drop on my frustration with the situation and myself not being able to do, what my colleague does, even though I want to. I felt the need for help, and I got it. Awesome community around here.

Re: Ask HN: Help, I'm Drowning in JavaScript

#47
Maybe take a step back and look at foundational topics such as higher order programming. Then you can take this foundational knowledge and apply and use it in any programming language and not be surprised when you come across it.

The ternary operator is born out of the need for an expression form of if-else. Some languages have if-else already implemented as an expression so they don't need a ternary operator.

Typescript exists to provide a static-typing discipline to javascript, if you don't care about this obviously you won't see the importance of typescript.

Re: Ask HN: Help, I'm Drowning in JavaScript

#49

Earlier quoted context omitted.

OP follow this advice, that's the best learning resource for modern JS. The #1 thing you can do for yourself first though is accepting that what you learned 20 years ago probably means dick. JS has radically changed and that's OK. Go into this book with that mindset and you will come out a champ.

After completion of Eloquent JavaScript and a decent comfort level with modern JS, is there an equally great resource to then transition into TypeScript?

Typescript docs are good [0], and it's incredibly easy to pick up, since it's just javascript with type annotations.

[0]: https://www.typescriptlang.org/docs/

Re: Ask HN: Help, I'm Drowning in JavaScript

#50
post #9

You 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…

This looks like copy pasta, I swear I've seen this before.

EDIT: I see

Post reply on HN