A Live Lesson in Diving into ES2015, with Darin Haener

Share this article

Diving into ES2015

Live Lesson — Diving into ES2015

SitePoint Premium’s first ever Live Lesson was held this month with Darin Haener, walking you through several sections of his Premium course, Diving into ES2015. Viewers were able to ask Darin questions while he went through parts of his own course, and provided the most accurate answers possible.

Hop over to the recorded Live Lesson with Darin Haener, if you haven’t seen it! In this post we’ll highlight the main points that were made and questions that were answered during the Live Lesson.

SitePoint Premium’s Live Lessons

These Live Lessons are new at SitePoint, and they are geared towards helping you to thoroughly understand the content in various parts of SitePoint Premium, and let you interact with other developers via the chat during the lesson, as well. They’re also an excellent preview of what SitePoint Premium’s courses are like, and the kind of information available in them. You can participate in this event and learn a lot, whether you have taken the course already or whether you’ve never even seen it. All are welcome!

Diving into ES2015

Diving into ES2015

The course Diving into ES2015 covers the next generation of JavaScript — ES2015. ES2015 is becoming a standard in browsers, and it’s crucial for JavaScript developers to learn about these new standards. With a thorough grounding in ES2015, you will be ready with a variety of new tools to tackle your projects as those tools become web standard! This Live Lesson covers several of the sections from the course.

Arrow Functions

Darin explains that with the arrow functions in ES2015, when you use an arrow function it automatically binds that function to lexical this. That, and the condensed responses that can come out of arrow functions, make for quicker code writing and can make your code much easier to read, and arrow functions are one of the reasons that ES2015 is as popular with developers as it is.

Destructuring

Destructuring is an amazing feature of ES2015, and provides an incredibly easy way by which to assign variables. Darin goes over using destructuring as a handy way to extract elements from objects without having to type out an entire path. Additionally, restructuring also allows for easily setting of default values in arrays and objects without causing problems, and you’ll also get a feel for this in the video.

Parameter Handling

As far as parameter handling goes, Darin explains that parameters can be manipulated in a variety of new ways in ES2015, such as giving parameters inline default values in the function call, rather than handling that inside of the function itself. It also allows rest parameters to be given, allowing as many arguments as needed to be inserted as array values, and the use of the spread operator within arrays.

Questions from Viewers for Darin

Q: Once ES2015 is fully supported by browsers, will we have to jump completely to ES2015 and stop writing JavaScript the way we did before?

 

Darin Haener: Most browsers have already adopted ES2015. If your code still runs, then yes (it’s fine). I don’t know off the top of my head anything that was deprecated or removed. As far as I know, there have only been additions.

I think you’re probably safe to continue writing code the way you used to, although I don’t know that I would recommend it, because you get left behind.

Q: What is the difference between const and let?

 

Darin Haener: First, the difference between const and let, const and let are both scoped the same, but the difference is const cannot be redefined. If I, in my code, said const a = 1, and then later down in the same code block, I tried to say const a = 3, that would throw an error. It would not allow me to, or even if I just tried to say a = 4, even without saying const, it would not allow me to reassign that variable. let will let you do that. So if you said let b = 1, then later on in the same code block, you could reassign it and say b = 3, and that’s allowed.

Using const and let, you get the same type of scoping, and just slightly different behavior.

Q: I usually see constant variables defined with capital letters — for example, const MYAGE = 20. Is that a requirement or just a good practice?

 

Darin Haener: It’s definitely not a requirement, but it probably is a good practice. Most every programming language has constants as capitals, all caps.

Q: Is it worth learning TypeScript or just stick with JavaScript?

 

Darin Haener: As far as I know, TypeScript is a little more strict. It has a strict typing system. I would say that if you’re more familiar with a language like C that uses strict types, then TypeScript is probably gonna feel more comfortable and familiar to you, so go ahead and use it.

Q: What do you think about coffeescript for ES6?

 

Darin Haener: I used to use coffeescript a lot, but I think that ES6 (or 2015) solved a lot of the same problems that coffeescript aimed to solve, and one issue that I had personally (and that’s just my opinion) with coffeescript was the meaningful indentation. I just personally, I’ve never liked that.

So I like the structure of JavaScript, having to use parentheses and braces to kind of enforce code readability. So from my perspective, I wouldn’t mix them, but to each his own.

Wrapping it Up

If you weren’t able to participate in the Live Lesson, and you have not yet watched the recording, do that now! The Diving into ES2015 SitePoint Premium course is available for your perusal, and Darin’s Live Lesson is an invaluable addition to that if you are going through it, or plan to in the future!

We were so glad to have him on for this first Live Lesson, brought to you by SitePoint! We hope it was a beneficial experience for the many JavaScript developers who signed up and watched live and asked questions — and for those who are going to watch the recorded version on SitePoint!

Jeff SmithJeff Smith
View Author

Jeff works for a startup as a technical writer, does contract writing and web development, and loves tinkering with new projects and ideas. In addition to being glued to a computer for a good part of his day, Jeff is also a husband, father, tech nerd, book nerd, and gamer.

Darin HaenerDarin Haener
View Author

Darin is a mostly autodidactic programmer, having learned Ruby, Rails, JavaScript, and React through a lot of trial and error, unit testing, and a lot of Googling. Darin has now fallen in love with React and currently creating an application that is very React heavy and with more testing than he's ever seen in a Javascript app.

ES2015es6javascriptlearn-modernjsLive LessonSitepoint Premium
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week