Join Eve Porcello for an in-depth discussion in this video Sets, part of Learning ECMAScript 6.
- [Instructor] Another new type included…in the ES6 spec is sets.…Set objects are collections of values.…They can be of any type, but each value must be unique.…The API is somewhat similar to that of maps,…but is a little bit different.…Let's take a look.…So, here on line 7, I'm going to create my first set.…So, I'm going to create a variable called books…and I will set it equal to a new set,…using this constructor function.…Next up, we're going to use a method…that is part of the set's object called add.…
And add is going to take in a string.…So, we'll say add Pride and Prejudice.…Let's add another book here.…War and Peace.…And I also want to point out that,…if we wanted to add multiple,…we could chain on different add functions,…so we'll say Oliver Twist.…Perfect.…So, let's log our books set to the console.…And when we take a look at this in the browser,…we should see our set that contains Pride and Prejudice,…War and Peace, and Oliver Twist.…
Another little property that we can use here…is we can say console.log, books.size…
- What is ECMAScript?
- Transpiling ECMAScript with Babel and Babel-node
- Using the let and const keywords
- Creating strings with template strings
- Enhancing object literals
- Working with ES6 classes and class inheritance
Skill Level Beginner
Q: The Babel API is out of date. How do I proceed with the course?
A: We are updating the course. In the meantime, you can install the babel-cli package and then install the presets that you need to follow along with the tutorials.
Building a Polling App with Socket IO and React.jswith Alex Banks3h 56m Intermediate
1. What Is ECMAScript 6 (ES6)?
2. Transpiling ES6
3. ES6 Syntax
4. ES6 Functions & Objects
5. Asynchronous Features
6. ES6 Classes
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.