in this challenge i had a function that gets the content from the JSON file but i was unable to add the content to a global variable, i had to call the function and read the content in his local scope, can somebody tell me if it is even posible to add the content of a external JSON to a variable, thanks and happy coding
Rajat Shekhawat
@rajat1997-proAll comments
- @Comet466Submitted about 3 years ago@rajat1997-proPosted about 3 years ago
hey, nice code just one thing that the time period should change dynamically, for daily it should be yesterday, for weekly last week, and for monthly last month. You can achieve this functionally by comparing the button text which is clicked with strings daily, weekly and monthly. ex: $(button).on("click",function (e){ buttonText = e.target.textContent.toLower(); if (buttonText === "daily"){ $(.daily-button).text("Yesterday"); } else if(buttonText === "weekly"){ $(.weekly-button).text("Last Week"); } else if(buttonText=== "monthly"){ $(.monthly-button).text("Last Month"); } })
Marked as helpful0