new class js -advanced
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
async function fetchData() {
|
||||
try {
|
||||
const response = await fetch('https://dummyjson.com/posts');
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
const data = await response.json();
|
||||
console.log(data);
|
||||
} catch (error) {
|
||||
console.error('Problem with the fetch operation:', error);
|
||||
}
|
||||
}
|
||||
|
||||
fetchData();
|
||||
Reference in New Issue
Block a user