Demonstrating ES6 class fearure and Promises.
The sample code shows the following:
- Creating a class using
class
keyword. - Inheritance using
extens
keyword. - Using private fields using
#
notation. - Using
super
keyword to access parents' constructor. - Accessing private a field using a getter.
- Overriding and extending methods.
The sample code initiates two request to a placeholder JSON API to get todos
and users
. Then it waits for the result from both request and map userId
in a todo to the userName
from users
The code shows the following:
- Handling promises.
- Chaining Promises.
- Creation Promises.
- Using
Promise.all
.