DEV Community

Margaret W.N
Margaret W.N

Posted on

3 2

Day 65: Bug fixes

Bug 1

I used Favicon checker to check the state of my favicon files and it was all a mess. Output from Favicon checker:
Alt Text

Alt Text

Alt Text

I initially used a smaller image, it was about 200px. That was the most likely cause of all the issues I got from the Favicon report. Fixed that by using a larger image and regenerating the manifest files. Here is the current report

Bug 2

I was using forEach() to loop through the array of weekly forecast data (from open Weather) in the displayWeeksForecast() function. The data set had an array length of 8 but I am only interested in the first six. I switched to a for loop and set the array length to 6 (data.length-2).

Bug 3

The cards created displayWeeksForecast() function were overflowing in smaller screens. I created a function to check screen width, then set the array length to 3 for small screens and 6 for larger screens. With an array length set to 3, the for loop would run thrice creating 3 forecast cards.

function checkScreenWidth(data){
    let arraylength = 0
    if (window.screen.width < 768) {
 arraylength = data.length - 5
    } else{
     arraylength = data.length - 2  
    }
    displayWeeksForecast(data, arraylength)
}

function displayWeeksForecast(data, arraylength) {
    clearPlaceholder()
    for (var i = 0; i < arraylength; i++) {
        //code to create cards and update data.
}
}
Enter fullscreen mode Exit fullscreen mode

Link to the weather app
I still have 2 more bugs to fix but I run short of time.

Day 65

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay