This was originally posted as a Twitter thread: https://twitter.com/chrisachard/status/1169223691122749440
Want to write javascript like a sane pe...
For further actions, you may consider blocking this person and/or reporting abuse
Chris, I was very impressed with your tutorial; but I was also quite dumbfounded. I'm basically a retread. I grew up in the era of mainframes, punch cards and COBOL. dBaseIII+ and IV reminded me how much I missed programming. However, I stayed on the admin/engineering track. Now we have DevOps (DevSecOps and DevNetOps in some places). I love the concept, but it's going to take a while before I can feel worthy enough to contribute anything. I thought that Javascript might be easy as I'd had a taste of JSON when I was doing PowerShell and .NET. You tutorial taught me alright. It taught me that I know NOTHING about javascript. I tried to follow along as best I could, but it was like trying to understand Integral Calculus again. Let's just say that I got my butt whooped and barely passed it all those years ago. Looks like I'm going to be sitting at the 'kiddies' table for a while as I try to learn these other dialects.
I love languages. I can even speak a few besides English. But right now, my heads filled with PowerShell, .NET, Terraform, Ansible, PowerCLI and so on. The further I get, the more I realize that I don't know and it can be frustrating; but at the end of the day, it really is still fun.
Do you by chance have a 'baby-primer' version of your class? I don't think that Javascript for Dummies could even help me right now. What I can relate to is your teaching style. You are a great communicator and your graphics for the examples are first rate. So I know that some day, I'll be able to understand your teachings a lot easier. For now, I'll take my dunce cap and go sit in the corner for a spell. Don't worry, I'm not giving up. It's all too much fun and if you and the community can be patient with a slowpoke like me, then I know that I'll make the grade - just a bit further down the road.
Meanwhile, if you ever need any help with VMware, or need a few virtual servers built somewhere, I offer my services gratis because I really want to learn from you.
LLAP,
Miguel (aka GulMiguel/Airwolf) :)
Don't feel bad! I should have been more clear at the top that this is a good ES6 intro if you already know javascript. If you don't have much javascript experience yet, then a lot of this was probably quite confusing :)
I don't have a crash course for basic javascript yet - but I do have one planned! So you can look forward to that at some point.
One of the better resources I've found is a great free book called "Eloquent JavaScript": eloquentjavascript.net/ which is much more complete and beginner friendly.
This website (DEV) also has some great intro JS resources! You may have to search a bit to find them, but I know I've read some good ones here in the past.
I hope that helps some! Let me know if there's anything I can help with specifically, or if you're really stuck on something.
Oh! and the best advice I can give is to just play around! use codesandbox.io or codepen, and just start to experiment there and see how things go.
Good luck learning!
Just remember that while you may be using
const
in a static context, it is still a mutable value.Yes, good point (I actually almost included a warning in there, but too many warnings and it would no longer be a "mini" crash course 😂)
Here's a good example:
So yes - if you really need immutability, then you have to use another library, like: github.com/immutable-js/immutable-js
[...someVariable] it's actually spread attribute not operator.
...
are called spread attributes which, as the name represents, it allows an expression to be expanded.And in this case (I'm going to simplify it).
…Open Full Answer
Thanks for the recap
The term "spread attribute" is mostly used by React/JSX. Not that it really matters, but the most correct terminology would probably just be "spread syntax" (the ECMAScript spec only refers to it as "SpreadElement" in its grammar).
Interesting... heh - so, on that page it's called all four of these things:
... and it seems to all refer to the same thing :)
I've also found "official" docs calling it at least three of those things 🤣
Is there an actual "official, for real" source for what it's called?
I believe, operators need operand(s).
ECMA divided this topic to:
Hm, interesting. Does the variable that the three dots are on not count as an operand? (I don't know what the formal definition is)
Somehow yes, but I think because this '...' thing introduced the time that syntactic sugar came up to JS so they tend to keep it as just helper syntax, some developers don't like it to be called as an operator because of other programming languages same debate.(some folks in this way would say one language has got more operators to another...:-))
Got, it (I think :) ). Interesting! I wasn't aware of the debate over the "operator" word. Thanks :)
This is a fantastic write-up of the core ES6 benefits! I just wanted to note that if performance is a concern for functions bound to
this
, then thehandleEvent
API carries infinitesimal overhead compared to the arrow function syntax andbind(this)
calls within the constructor.Quite late to the party here, but a cool thing to note regarding your point 5 is that you can also "selectively" deconstruct an array, that is, select only certain elements. Like this:
Or more advanced:
Yes, definitely! You can also put an underscore in the places you don't care about... eg:
I just switched back to var...
Great article except the usage of var. I would not discourage it, as let is limited to the scope of braces whereas var is limited to the scope of the current this (function) context. Both have strengths.
Great article! Simple and useful, thank you!
Yep! There is also a solution that involves renaming files to .mjs and using
--experimental-modules
, but I find esm works really well in practice (and is easier)I enjoyed a lot Chris, thank you very much!
I needed a pocket reminder like that.
You're welcome! I had a lot of fun making it - trying to distill such a large topic into small, bite-sized chunks :)
Very Interesting I'll share this post in my community.
I plan to! Thanks 😄