It’s day 6 and I’m feeling optimistic! At the beginning of the day, I didn’t know what to do for today’s website [I would love to hear your suggestions, imaginary readers]. So I did what I do best, procrastinate. Sipping a cup of tea, and watching Last Week Tonight with John Oliver [love that dude] I think I then heard the word ‘time me’ which made me think of the time when both my siblings and I would get out a timer and compete who would do something in the least amount of time [damn that competitive attitude], and thought to myself ‘Hey! Why not do a timer? it’s simple and doable’. So yeah We’re doing a timer today.
This time, I learned. Do all the structure, and style [ESPECIALLY responsiveness] first then move on to logic. And that’s what I did [I’m learning yo. True progress]. Instead of doing the design in illustrator, then moving to the browser, I decided to directly style from my browser and test what works.
all was good until that dreaded media query hit 🙁
Don’t panic Athoug. Chill. You don’t function when you panic. [I give myself mental notes] I sipped tea to chill, and continued to fix my code. Thus what we have is
Lessons to learn, not freaking about works [or maybe it’s just the tea]. Brilliant. I have the UI already and working. So now We move on to the logic.
Now here is where I was so tempted to look at a tutorial but chose otherwise. I want to learn let’s see how my brain works. It doesn’t have to be the optimal solution it just needs to work. To quote my Algorithms professor “First make it work, then make it fast”.
At first, I need to figure out the timing functions. To see if truly 1 second passes each time. It took a while to figure out the proper way. I kept getting zeros, then undefined then nothing at all. Basically, my variable scope was all messed up but after some adjustments, I figured it out. As you can see, my console is counting [happy dance]
I then started the logic. To be honest, the nested ifs, made me feel that hey surely there is a better way to do this. Then one of the samples I look at after finishing made me a bit happy because it’s sorta kinda like mine. while the rest kept using the date object. It’s really interesting to see other peoples approaches. Anyways, I stuck with my nested ifs and the moment of truth came where I check if it works or not…
[yaaaay] I’m really happy with this one. Will use it from time to time. You can check it out here. Share your thoughts with me. Oh, and I decided to list the resources that helped me and different versions of stopwatches.
https://athougcodesatnight.com/wp-content/uploads/4-2.gif434540athoughttps://athougcodesatnight.com/wp-content/uploads/Athoug-Codes-at-night_text-300x138.pngathoug2017-12-22 13:42:222017-12-30 10:21:24Time Me Day 6