Design comparison
SolutionDesign
Solution retrospective
-
How are you able to print out the data.json information using vanilla Javascript? This is something I've been wondering about.
-
Any advice on how to make this more streamlined?
Community feedback
- @agomez99Posted over 1 year ago
You can use the fetch API
fetch('./data.json') .then(response => response.json()) .then(data => { // Access the JSON data here console.log(data); // You can iterate over the array and access each object's properties data.forEach(item => { console.log('Category:', item.category); console.log('Score:', item.score); console.log('Icon:', item.icon); }); }) .catch(error => { console.log('Error:', error); });
Marked as helpful1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord