Re:Ask HN: Help, I'm Drowning in JavaScript
by Jiocus on Wednesday August 03, 2022 @07:11AM
(#32330154)
This was the answer I was hoping to see with regards to OP's current troubles. Thank you.
Re:Ask HN: Help, I'm Drowning in JavaScript
by UncleEntity on Wednesday August 03, 2022 @05:37AM
(#32329547)
WTF, dude?
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
by perilunar on Wednesday August 03, 2022 @10:38AM
(#32332352)
WDYM WTF? He's clearly telling you that you can't parse HTML with regex. Don't even try.
Re:Ask HN: Help, I'm Drowning in JavaScript
by easrng on Wednesday August 03, 2022 @03:48PM
(#32335984)
s/He/She/
Re:Ask HN: Help, I'm Drowning in JavaScript
by gleam_user on Wednesday August 03, 2022 @02:43PM
(#32335358)
This looks like copy pasta, I swear I've seen this before.
EDIT: I see
Have you tried using an XML parser instead?
- https://stackoverflow.com/a/1732454
With that aside, for parsing HTML with node, use cheerio. It has a jQuery-style API and IIRC is more lightweight than jsdom (which is what I'd suggest if cheerio isn't enough). If you're parsing HTML in a browser, you don't need any libraries, use a DOMParser. Arrow functions are just normal functions but with `this` automatically bound to the `this` of the scope they are in. MDN is your friend.