Section Overview
We'll cover more ES2015 features. These are more obscure, occasionally more difficult to understand, and have more limited use cases, but they make certain tasks easier and our code more elegant.
Advanced Features
The following lessons include ES2015 constructs that aren’t used very often in writing code. Learning these concepts will unlock more elegant ways of accomplishing certain tasks.
New Data Structures
We’ll cover sets and maps, two data structures that have been added to JavaScript. While objects have all the functionality of both, these constructs make certain tasks slightly more intuitive. They allow us to store data in ways that make it easier to retrieve and work with.
These data structures show their value when dealing with data that makes use of their strengths. Sets are excellent at filtering data. Maps are excellent when object keys need to be dynamic.
These data structures aren’t used very commonly in professional software, but knowing them will improve your ability to think critically and attack a problem from different angles. They’re especially impressive when used in coding interview problems.
New Data Type
We’ll cover Symbols as well. These are a brand new data type with a singular purpose and their behavior is quite odd.
Customizable Iterators
Symbols are also needed to understand the implementation of iterators, which will allow us to define custom behavior in loops. We’ll be able to override the default behavior of loops and extend their functionality.
New Type of Function
Generators are last and allow us to create iterators easily. We can essentially return from a function multiple times and even pass values into the function. They’re very powerful and provide a new interface to solve complex problems.
— — —
Again, none of these items are needed to write functional, powerful code. However, the concepts embedded in these constructs help us understand problem-solving in new ways. We can come up with new solutions to problems and solve them more elegantly with these tools at our disposal.
Many of these constructs will stretch our understanding of JavaScript and of software engineering itself. They’ll open our minds and, if nothing else, they’re fun and interesting to learn.
I’ll see you in the next lesson.
Get hands-on with 1400+ tech skills courses.