Digital Clock Practice Project
Hayk, I have been to solve this problem in my code for a few days, I tried ai, tried asking ai questions, try searching in documentation. I also kept asking myself what concepts to put for this feature, tried searching youtube for similar patterns, tried commenting out code one piece at a time when I thought there was an issue, try using the break points and looked at scope and call stack. I still can't find out how to solve the problem.
I tried to go to the weather project in the course and figure this out to but that was for async wait, and my project I don't think use async wait. I asked ai do I use async wait for this problem, and it said no.
The problem was my city and time values will show even before clicking the show city button, but I needed the setInterval for the city and time values to change and update live on the screen. The problem is when I use set Interval it would show the city and time values even before clicking the show city button, but when I comment it out, the city and time values will show on the screen when I click the show city button, but the city and time values will be static and won't update live.
I commented out this piece of code cityIntervalId = setInterval(updateCityTime, 1000); , and then my city and time values, like the city, time(hours,minutes, seconds) showed on the screen when the user click, but the time was static.
Hayk, in real world applications, don't you use SetInterval and at the same time the results will only show when clicking the show button or do I need to choose between keeping setInterval and allowing the city time values to show before clicking the button and remove the showCityButton by writing the remove event listener for the show city button to prevent memory leaks and then remove the show city button from the html file or can this be fixed where I can have setInterval update the city and time and only show when users click the show city button?
Hayk, another thing is, Even though I went through the JavaScript tutorial of how to use breakpoints, I don't know what values is unexpected, like how do you know when that value is unexpected? Hayk, can you review my code, but also make a video of how to use the breakpoints, local scope, and call stack for this problem to just to see how I can debug this? I was trying to get more practice on the debugging using this debugging strategy and I am just trying to get better at coding and web development.
This is just a practice project I gave myself for JavaScript. I was practicing projects while looking for freelance clients.
2
24 comments
SeaAmber Silver
6
Digital Clock Practice Project
Dev Mastery
skool.com/devmastery
Break out the mid-tier developer trap. Get to Senior, fast.
Leaderboard (30-day)
Powered by