Course info
Aug 10, 2016
1h 44m

The world of JavaScript is changing rapidly and Node.js is doing its best to try and keep up. In this course, Using ES6 in Your Node.js Web Application, you'll get a look at how to integrate the new ES6 features that are available in Node.js into your web applications. You'll start with seeing some of the features that provide simplified syntax in ES6 and how to implement these into your code. Next, you'll see two new types of variable declarations, as well as some additions to the function options. Finally, you'll see some of the cool, new built-ins from ES6 including Promises, which are a great way to eliminate callbacks. By the end of this course, you'll be ready to implement many of these new features in your web applications.

About the author
About the author

Jonathan Mills is a JavaScript and Node.js expert working mostly in the MEAN Stack with individuals and companies to help build their technical skills to cope with the constantly changing landscape of software development. He is also an ASP.NET insider and an international speaker focusing on JavaScript both in the browser and on the server.

More from the author
Testing JavaScript for Node.js with Mocha
2h 28m
May 4, 2017
More courses by Jonathan Mills
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone. My name is Jon Mills, and welcome to my course ES6 with Node 6. I'm a consultant focusing mostly on JavaScript technologies, and it's been fun to watch JavaScript over the last 12 months or so evolve and add all these cool new features that are now baked into Node 6. And so in this course, we're going to take a look at some of the cool new JavaScript syntax and JavaScript features that are included in Node. Things like syntactic sugar and some cool new shortcut notations, some built-ins like promises and generators and things like that, and we'll take a look at some function changes that include class and what that means and how that's going to work in ES6. Now, we're going to focus mostly on the Node side. Some of our examples are going to be very Node-specific, and I'll show you some examples even from my Web Apps course and how using ES6 is going to change some things that we are doing there. But you don't have to be a Node developer to get something out of this course. If you just want to watch through the course and see some of the ES6 stuff, that's cool too, just know that having some JavaScript experience and having some Node experience will help you follow along maybe a little bit better.

ECMAScript and Node.js
In this course we're going to look into what's available in the latest versions of Node from an ES6 perspective, so what are the features and functions that we can use as we upgrade to the latest versions of Node. Now before we get started though, we're going to take a quick look at some basics in order to get everybody on the same page. So we'll start by talking about Ecma and what Ecma is and where they came from and how they're involved in the JavaScript area. And we'll talk about ECMAScript, because it's not JavaScript 6 or JavaScript 2015, it's ECMAScript. So we'll talk about what ECMAScript is and how that works with JavaScript. We'll talk about ES6 features. ES6 is just a bundle of new features and functionality that's been bundled into ECMAScript, and so we'll talk about what those features are, that's going to be the majority of this course, and what support they have across the multiple engines and across the multiple versions of Node. And specifically we'll focus on Node's ES6 adoption. And I'll walk you through for each feature which version of Node you need to be running in order to support the feature that we're talking about.

Some Syntactic Sugar
This first section of ES6 features that we're going to be talking about are basically just some syntactic sugar. Just some nice little syntax changes that we have that are going to make our lives a little bit easier when it comes to writing code. Nothing earth-shattering, nothing really feature-changing, just some cleaner implementation of some things that we do every day, and a lot of it's just shortcut notation, but it's cool when you get right down to it. And some of the things you can do that used to be even a few lines of code, now you can do just with a couple of key strokes, and it's really, really cool. So let's take just a little bit and look through some of these cool syntax changes that we have in ES6.

New Bindings
So now that we're done with the syntactic sugar type changes in ES6, let's talk about the new binding options we have in ES6, and this is actually going to be some functionality changes and some changes in behavior on the way variables work in ES6. So this is not just sugar anymore. The whole last module was stuff you could do anyway; this is different, and this is no longer just a different way to do the same thing. We're going to make some actual variable changes now. The way variables work, or the way some variables work in ES6 are going to be fundamentally different, and the reason for that is they're fixing some scoping issues. In ES5 we don't have block scope, and in a lot of other languages, you have block scope, and since JavaScript is probably not your primary language, we forget that we don't have block scope. And so we've got to find a way to fix that now in ES6.

Function Changes
In this module, we're going to start talking about some function changes or some different function types that exist in ES6. We'll start by talking about arrow functions, and this is a cool new shortcut notation to do functions. Now the awesome part about arrow functions is it changes the this binding to more of a lexical binding, and we'll talk about what that means here in just a little bit. But arrow functions in callbacks especially start to behave so much better and it helps us out quite a bit. We'll also talk about classes, and we're talking about classes in a module about functions, because ultimately in JavaScript that what classes are. If you're coming from a C# or a Java background, classes are different in JavaScript than they are in these other languages, and we'll talk about what that means and how they're not exactly what you're used to, but they may be a useful way for you to create objects in JavaScript if they're going to fit the model that you need.

ES6 comes with some really cool built-in features that make our lives a little easier when dealing with things like arrays or collections of objects, and they also provide a very cool alternative to callbacks. Now there are several of these built-ins listed out on the kangax website, but we're only going to dig into three of them that I think might be the most useful to you in your Node. js development. We're going to start by having a conversation about sets and how sets are an array-like thing that makes sure that each piece in the array is unique and some functionality built around that, and those are pretty cool. We're also going to talk about maps, which is kind of a combination between a JSON object and a JavaScript object and makes our lives a little bit easier so we don't have to jump all the way to a JavaScript object when we don't really need that structure. And we're going to end with a conversation about promises and how promises help us deal with asynchronous code a little bit more cleanly than callbacks do and kind of separate out our concerns a little bit and make our code much more readable when we're dealing with asynchronous code.