JavaScript How to get JSON data from the API of a web-service?

preview_player
Показать описание
Let’s use a free API that returns some data.
To get data we need the fetch method.
This method has one parameter: URL.
The method returns a promise object.
The promise has the then method to handle the response asynchronously.
We need the json method to convert the response to the JSON data.
OK.
Let’s check it out.
We have got the response from API.
The response is in JSON format.
Рекомендации по теме