Join Eve Porcello for an in-depth discussion in this video Building promises, part of Learning ECMAScript 6.
- [Instructor] Often we use promises to load data.…Let's create a function called space people…that returns a promise.…We'll call it space people because it's going to fetch…some data from an API of astronauts currently in space.…So here we're going to say const space people,…this is going to be a function that returns a promise.…So inside of these curly braces we're going to say…return new promise.…And then we're going to pass in resolves and rejects…as our arguments here.…
Now the next step is we're going to load this data.…We're going to need to add a few variables here.…The first is our API, and we'll find that at…http API.open-notify….org/astros.JSON.…Then we're going to create a variable for a request.…Now the request is going to be…a new XML HTTP request.…
Next we're going to define what type of request it is,…so we're going to say request.open,…and this is going to be a get request,…that we will send to this URL, this API.…Cool, so once we have opened our request, we have…made a connection to the API,…we're going to use request.onload,…
- 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.