Table of Contents
00:00 - 07:35 Introduction Aaron Frost is a Sr. Frontend Developer at DOMO. He spends a few minutes before beginning the course with an introducing himself and outlining what he will be covering.
Proper Tail Calls, Declarations, and Rest Parameters
01:11:04 - 01:23:43 LET The LET keyword has two parts: LET Definitions and LET Looping. Definitions are its most basic form. It's used just like the VAR keyword. Using LET in loops can be advantageous since temporary variables like "i" are not hoisted out of the loop and linger after the loop executes.
01:23:44 - 01:32:29 CONST and Blocks Constant variables cannot be changed and will throw an error if an assignment occurs. Blocks in ES6 allow developers to create nested scopes on the fly using curly braces. Aaron shares couple code example and ends this section with some audience questions.
01:32:30 - 01:39:15 Rest Parameters Rest parameters allow developers to use a single parameter in a function to catch multiple parameters passed to the function. By prefixing a parameter with three dots (i.e. ...args), values passed to the function will be placed in an array with the name of the rest parameter.
01:39:16 - 01:49:04 Rest Argument Rules Aaron walks through a number of rules that exist when using rest parameters. There can only be one per function, it must be the last argument, and it can't have default values. Aaron also take the audience through a couple code examples.
Spread Operator, Destructuring, & Arrow Functions
01:49:05 - 01:54:17 Spread Operator The spread operator extracts individual values from an array. This is useful when needing to combine multiple arrays or spreading results of a method call.
01:54:18 - 02:01:14 Destructuring Destructuring allows developers to bind a set of variables to a corresponding set of values. The syntax can seem backward since braces are used on the left side of the assignment. Aaron walks through a simple example to help explain this technique. He also show how to alias the variable names being destructured.
02:01:15 - 02:08:31 Old Way vs. New Way Aaron starts by showing the way we destructure objects today. He then walks through a few few variations using the new syntax that improve the readability. While the performance may be slightly improved by having less syntax, the differences are mainly aesthetic.
02:08:32 - 02:15:30 Destructuring Pattern Aaron takes a step back and explains the logic behind the destructuring pattern. You can only deconstruct an Object. Also, the object must contain the properties assigned during the deconstruction. Aaron also demonstrates how to handle properties not contained in the target object.
02:15:31 - 02:25:19 Patterns In-Depth Now that Aaron has described the Irrefutable and Refutable patterns in destructuring, he goes a little deeper into their intricacies. He demonstrates different ways they behave based on their refutable nature, default values, and nested position.
02:25:20 - 02:34:17 Destructuring Arrays Square brackets, as opposed to curly braces, are used to destructure arrays. Aaron walks through a few practical use cases for destructuring arrays including swapping variable or improving method signatures.
02:34:18 - 02:40:25 Questions Aaron answers a few audience questions on the benefits of destructuring. He also talks a little about compatibility and gives a couple last code examples before moving on.
02:40:26 - 02:48:46 Arrow Function Syntax Arrow functions present a more concise syntax by eliminating the function keyword which can create shorter function declaration and definition. There still rules for how parameters or the function body are implemented.
02:48:47 - 03:01:10 Arrow Function Examples Aaron walks through a few example where arrow function are useful. He also demonstrates why the real benefit of arrow functions is the lexical scope binding of the this keyword.
03:01:11 - 03:06:36 Functions vs. Arrow Functions Aaron quickly demonstrates why developers will still need to use traditional functions and can't completely replace them with arrow functions because they can cause scope issues.
03:06:37 - 03:16:06 Exercise: Arrow Functions Aaron gives the audience some time to experiment with Arrow functions. He also answers a number of questions about their usage. This segues him into a coding example that uses arrow functions, destructuring, and default parameters.
Default Parameters, Classes, and Collections
03:16:07 - 03:23:17 Default Parameters Rather than data-proofing a function's parameters, default values can be specified to ensure a parameter has a value even if there isn't anything passed to the function. This allows for less code to be written and a more readable API. Default parameters can also be assigned with a method call.
03:23:18 - 03:33:58 Exercise: Default Parameters Aaron leads the audience through a code example that uses a method as the default value. This method returns a counter that is incremented when no parameter is specified. He also demonstrates how exceptions could be used when no value is present and other gotchas (like lexical scope) that can arise.
03:33:59 - 03:42:09 History of ES6 Classes Aaron spends a few minutes describing the history of classes in ES6. He steps through Russell Leggett's proposal that talks about how this implementation of classes needs to address the need today, but be future friendly.
03:42:10 - 03:47:32 Class Syntax From a functionality standpoint, declaring a class is the same as declaring a function. They both can use the new keyword and be executed when instantiated. Aaron walks through the syntax and demonstrates that most of the features in classes can be implemented today using functions.
03:47:33 - 03
08 Private Properties Aaron demonstrates how Symbols in ES6 can be used to create private properties. While, this technique for private properties can be done today, the Symbol object makes these properties slightly more obscure.
09 - 04:08:37 Getters, Setters, and Class Properties Developers use getters and setters to expose private properties in an API. Aaron adds a getter and setter to his Monster class. He also demonstrates how to create public properties and methods and static types on a class.
04:08:38 - 04:12:59 Extending Classes Classes can be extended using the extends keyword. This is very similar to what can be done today with prototypes. Aaron also demonstrates how the extends keyword can be method call that's evaluated at runtime making the super class dynamically assigned.
04:13:00 - 04:20:15 Additional Class Features Aaron explores a few other features of classes that are still being discussed. This includes how the super() method is called and default behavior when there isn't a constructor. He ends the section on classes with a summary of their benefits and a few audience questions.
04:20:16 - 04:24:21 Collections Collections are new ways of storing data similar to arrays or objects. Sets, like arrays, add values in a linear fashion. However, they force unique values. Sets have useful methods like has(), clear(), add(), and delete(). They also have an iterator which makes them efficient for looping.
04:24:22 - 04:36:01 Collection Maps & Weakmaps Maps, similar to JSON objects, are name-value pairs. Get and set methods are used to read/write values to the map. Weakmaps are similar to maps, except their reference to an object doesn't prevent garbage collection.
Modules, Promises, & Generators
04:36:02 - 04:46:01 Modules Currently modules are really unsupported and only available through polyfills. They have two parts: Import/Export syntax and a Programatic Loading API. Modules can have a default object specified for exporting. Import statements can specify multiple modules from a single library.
04:46:02 - 04:51:11 Module Programatic Loading API The Module Programatic Loading API uses promises to externally load modules. Developers can also catch any errors that may occur and handle them accordingly. Aaron demonstrates how this API can be used to load multiple modules and explores a few of the additional methods.
04:51:12 - 05:00:54 Promises Promises make asynchronous code cleaner and more maintainable. They are created using the Promise() constructor. A promise is typically in one of four possible states. It can be fulfilled, rejected, pending, or settled. Code needing to wait until the promise returns can be wrapped in a then() method.
FYI -- we also put together a starter project for you with a Grunt workflow: https://github.com/FrontendMasters/es6-grunt-getstarted
05:24:15 - 05:29:09 Wrap-up Aaron wraps up the course discussing a few of the ES6 features he didn't cover. He also talks about using the ES6 Compatibility Table to recognize what's supported and the current state of the specification.