Files
JavaScript-from-Beginner-to…/Chapter 15/Exercise 15.1
T
2021-11-30 18:27:48 +05:30

20 lines
395 B
Groff
Vendored

// This is a json object, create a file named list.json and place this object[] in it
[
{
"name": "Learn JavaScript",
"status" : true
},
{
"name": "Try JSON",
"status" : false
}
]
const url = "list.json";
fetch(url).then(rep => rep.json())
.then((data) => {
data.forEach((el) => {
console.log(`${el.name} = ${el.status}`);
});
})