r/coding • u/kisancodes • May 28 '21
20 JavaScript Concepts you should know as a JavaScript Programmer!
https://blog.devgenius.io/20-javascript-concepts-you-should-know-as-a-javascript-programmer-c04d7b1a8d6e?sk=cc9a655f3a07686a9a1cdd4825c73e1814
u/Fitzi92 May 28 '21
9. b. Arrow Function isn't correct. Arrow functions are not just a different syntax for functions. The don't have their own bindings to `this` for example, as well as some other limitations ( see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions for details )
Also 12. Currying is lacking an explanation what currying actually is and why it can be usefull imho. Just stating that it's an advanced topic and adding a incomplete code snipped isn't exactly helpful. At least a link to some further readings would be useful.
The rest seems pretty solid though.
4
u/TheRedGerund May 28 '21
Never actually needed to use currying in my job. Starting to wonder if it’s actually useful or just a cool trick.
1
u/CastigatRidendoMores May 28 '21
I’ve used currying quite a bit. It’s historically been used a lot in react and redux, where you might want to initialize a function with some arguments and then pass it somewhere else to be called. The common blog examples I’ve seen include more of a functional style than I’ve typically found useful in js, such as conversion functions where you initialize a general multipurpose function to be used in a specific way.
4
5
u/CastigatRidendoMores May 28 '21 edited May 28 '21
It’s a solid list of concepts to learn, but the article needs some work before it would be useful for learning. Examples:
A closure should redefine itself as the inner function so the outer function is only called once. The author’s example doesn’t do that, nor does it demonstrate the use case for closures.
Saying you need to learn generators is a stretch, though the author clearly agrees due to the lack of any examples at all.
Finally the first several concepts mostly don’t matter with ES6+, but you definitely want to know them for interviews and understanding legacy code.
3
u/must4che May 28 '21
I also think that hoisting is very poorly described in this. This whole list looks like it was written by someone with one year experience with javascript. Yeah and author declares it by himself at the beginning of this article.
Edit: to be fair to the author I must admit that I gave up on reading after 5th topic. Just seemed like not worth reading anymore.
5
2
u/HappyBigFun May 28 '21
Not the best at explaining these concepts or using them correctly. For example, the first few sections on scope/hoisting talks about globals and uses var but doesn't mention let.
(later, let is used with a typo "greenting" which makes the code snippet not work, but that's just a nitpick)
2
u/Josuah May 29 '21
As soon as I read the first section on scope, I knew the write up wasn't going to be great. The "correct" answer to #1 would be to discuss lexical scope.
1
u/AlexanderThulin May 28 '21
The list itself is not bad (don’t really agree with generators being in it, but let’s not focus on that). But, if you really want to write good blogposts spend some time on them. The section on currying, for example, is nothing more than the first (non-explanatory) paragraph from the hit on google with an incomplete example from the same article. As of now, this list would be more useful if it was just a list with maybe links to some more in depth articles. Lastly, good initiative but if you want to write good and informative articles you need to spend some more time on them!
1
u/illuminatedtiger May 29 '21
If the author posted this I would suggest including the code as part of the article text next time as opposed to images. I tried reading it on my phone and had to stop.
34
u/michaelobriena May 28 '21
This is not a great list. I’d not waste you time reading this.