5 ms·
I'm a senior web developer now, started with other languages. This is a bit embarrassing but here goes: 1. I wish I had known how asynchronous stuff worked bef
by Zyst 8y ago
I'm a senior web developer now, started with other languages. This is a bit embarrassing but here goes:
1. I wish I had known how asynchronous stuff worked before I got into JS. OR studied it in JS a bit more formally. I had a couple of months where I was confused as hell, because I didn't really understand how to do async, promises weren't really a thing you could use if you had to do older browser support back then.
2. I really wish I had studied JavaScript. I didn't, at all. I was like "Yeah front end is easy anyway, lets roll" and just got started developing. I did so many stupid things, suffered so much, and really resented the language at so many different points exclusively out of my own ignorance. Once I got my head out of my ass, and actually studied the language in depth I felt like so many things started making sense.
To conclude with 2, I remember having a distinct realization that it wasn't JavaScript that was shitty. I had been a shitty developer for having not studied it.
Anyway, if I can give some advice those two would be it, understand how asynchronous flows work, and learn the language.
- cutety 8y agoCompletely agree. Aside from learning the basics of the language (which if you already know any other "C like" language isn't difficult), gaining a good understanding of async flows (Promises then async/await) is absolutely key in JS and is probably the biggest hangup I see people run into. Where I work I'm considered the JS "expert", my coworkers consist of a few older seniors that mostly do backend work that think JS is bad/confusing language, and a few juniors that really only have experience with languages they learned in school (which probably doesn't include JS). And 90% of the issues I help them with are caused by a lack of understanding of async JS -- "why is this value undefined?" or "how do I get the data out of a Promise" and for the latter telling them "well, you don't get the data out of a Promise, you would chain it with .then(data => data) to operate/use the data" is usually met with even more confused looks. Though async/await helps a ton with how they use the data from a resolved async operation, you still need to understand promises (at least a little) since it's built on top of them (e.g. in a try/catch async block the lines after the await are essentially the function that gets passed to promise.then() and the lines in the catch block being the function that gets passed to promise.catch()). Two other things I'd like to mention (which could be under "learning the language") that I think really help with really understanding JS and being able to use it well are: 1. Understand the Event Loop[1]. Learning this will make a lot of JS's oddities make sense, and is something you should learn even before learning about async JS as it will explain how your async function actually works under the hood (i.e. the non-blocking nature of JS). 2. Closures/Scoping [1] https://www.youtube.com/watch?v=8aGhZQkoFbQ https://www.youtube.com/watch?v=8aGhZQkoFbQ
- rhapsodic 8y ago>2. I really wish I had studied JavaScript. I didn't, at all. I was like "Yeah front end is easy anyway, lets roll" and just got started developing. I did so many stupid things, suffered so much, and really resented the language at so many different points exclusively out of my own ignorance. Once I got my head out of my ass, and actually studied the language in depth I felt like so many things started making sense. Based on my experience interviewing candidates with years of alleged "experience", I marvel at how many so-called professionals don't bother to learn Javascript in any depth. I've had more than a few candidates that couldn't demonstrate how to iterate through the elements of an array, for example. Or correctly give the truth value of expressions like: " "; ""; undefined === null; and on and on. These, to me, are dealbreakers. If someone can't rattle them off, I'm not going to pay them the six-figure salary they claim they're worth. I'm surprised at the amount of resentment this sentiment of mine generates here on HN, of all places, but it does.
- ta43737553757 8y agoThe fact that you even need to ask those questions (about the truthiness of those variables), means the language is a dealbreaker, to me. What absurdity.
- rhapsodic 8y ago>The fact that you even need to ask those questions (about the truthiness of those variables), means the language is a dealbreaker, to me. What absurdity. By "dealbreaker", do you mean that you will not take a job that requires you to write Javascript at a professional level? If so, kudos for walking your talk.
- deleted 8y ago[deleted]
- balfirevic 8y agoIs your comment sarcasm? I seriously can't tell.
- 8y ago
- duxup 8y agoRTFM hits me all the time. I was struggling with something recently. Gave up and went to eat. I was standing in line and googling around a bit and blammo in the documentation ... right there, as if it was written for me was a paragraph saying how to do the thing I kept dorking up word for word. If I had just taken the time to read that software's instructions past page 3... but nope I didn't.
- BrandoElFollito 8y agoI am with you on the asynchronous part. Dev wise, I am an amateur for 30 years (this is not false modesty, I code for fun only and do not follow the correct practices), coming from a C, Perl and now Python world. A world of code which is executed line by line. I tried JS via Vue. Oh man, it was hard initially judt because I did not realize that there is a niw concept I now call "things will happen when they happen and my code is a bunch of blocks of such stuff". This is particularly visible in Vue where you know that your code starts with mounted() and then everything happens when something triggers it. Specifically methods and data change. Once I realized that, JS is nice. OTOH I never, ever managed to understand asynch code in Python (which I know much better than JS)