<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<script>
const urlTest = 'https://raw.githubusercontent.com/dupontdenis/revision/master/test.json'
const load = async () => {
try {
const response = await fetch(urlTest);
const data = await response.json();
//return or directly insertToDOM
return data;
} catch (error) {
console.log(`file?: ${error}`)
}
}
load().then(({ products }) => {
products.forEach(({ Name, Price }) =>
document
.body
.insertAdjacentHTML('afterbegin', `<p> ${Name}: ${Price} </p>`))
});
</script>
</body>
</html>