1fetch('https://jsonplaceholder.typicode.com/posts').then(function (response) {
2 // The API call was successful!
3 return response.json();
4}).then(function (data) {
5 // This is the JSON from our response
6 console.log(data);
7}).catch(function (err) {
8 // There was an error
9 console.warn('Something went wrong.', err);
10});
11
1fetch('https://jsonplaceholder.typicode.com/posts').then(function (response) {
2 // The API call was successful!
3 console.log('success!', response);
4}).catch(function (err) {
5 // There was an error
6 console.warn('Something went wrong.', err);
7});
8