Dec
20
PBS 46 of x – ES6 Spread Operator, Arrow Functions & Classes
Filed Under Computers & Tech, Software Development on December 20, 2017 | 1 Comment
We’ll start this instalment by having a look at my sample solutions to the previous two instalments, and then we’ll move on to looking at three ES6 features, two of which are extremely significant. We’ll start by addressing an accidental oversight from the previous instalment when we looked at arrays. I had intended to cover the so-called spread operator together with Array.from()
and the for...of
loop, but it slipped mind. Once we’ve dealt with my little oversight we’ll introduce an entirely new type of function that removes the need for the const self = this
kludge for callbacks. So-called arrow functions greatly simplify the use of callback in JavaScript, and in modern JavaScript, callbacks are everywhere!
Finally, we’ll make a start on my personal favourite new feature in ES6 — classes. This major change brings JavaScript into line with the other C-style languages, and, more importantly, into line with how most programmers are used to working. This takes JavaScript objects from weird esoteric things only those initiated into the JS cult can understand at a glance to intuitively understandable constructs. For those of you for whom JavaScript is your first language, classes will be nice, but for those of you coming to JavaScript form other languages, classes will be a blessed relief!
We’ll only be covering the basics of the class keyword in this instalment. In the next instalment we’ll take things up a notch when we finally explore the concept of polymorphism, the heart and soul of object oriented programming.
Dec
10
PBS 45 of x – ES6 Arrays & Strings
Filed Under Computers & Tech, Software Development on December 10, 2017 | 2 Comments
We’ll start this instalment be re-visting the question of when to use let
and when to use const
for variable declarations. My initial advice was to default to using let
, but based on some great feedback from the the community, I’ve changed my mind, and will be defaulting to const
going forward. I’ll explain why I changed my mind.
Next we’ll have a quick look at my sample solution to the challenge set at the end of the previous instalment, before moving on to some new material. Specifically, we’ll look at some of the ways in which ES6 has improved arrays and strings.