I'm proud I was able to fetch data from JSON file. It was my first time to work with that type of file and it doesn't look like professional code for sure, but it works well. Now I want to learn more about fetching data from external sources.
What specific areas of your project would you like help with?If u know please tell me how I can improve my code in this fragment:
fetch("./data.json")
.then((res) => res.json())
.then((data) => (
(workCurrentTime.textContent = data[0].timeframes.daily.current),
(workPreviousTime.textContent = data[0].timeframes.daily.previous),
(playCurrentTime.textContent = data[1].timeframes.daily.current),
(playPreviousTime.textContent = data[1].timeframes.daily.previous),
(studyCurrentTime.textContent = data[2].timeframes.daily.current),
(studyPreviousTime.textContent = data[2].timeframes.daily.previous),
(exerciseCurrentTime.textContent = data[3].timeframes.daily.current),
(exercisePreviousTime.textContent = data[3].timeframes.daily.previous),
(socjalCurrentTime.textContent = data[4].timeframes.daily.current),
(socjalPreviousTime.textContent = data[4].timeframes.daily.previous),
(selfCareCurrentTime.textContent = data[5].timeframes.daily.current),
(selfCarePreviousTime.textContent = data[5].timeframes.daily.previous)
)
);
I didn't know how to use loop or other staff to minimize proces of looking for data.