Lab 31 Reflection

     Lab 31 was about creating a list of videos with a data-time attribute and using JS to calculate and display the total amount of time it would take to watch all the videos in the console. I started by creating a list of videos, which weren't actual video, rather, an unordered list of video names with a data-time attribute containing its length. Once this list was set up, I created a variable that stored the value of the data-time attribute of every item in the video list. Next, I used the .split() method to store the second and minutes in separate variables. The total amount of minutes was multiplied by 60 and added to the total amount of seconds, then using Math.floor() functions, I attained the total amount of time in the hrs/min/sec format. This was stored in a variable and logged in the console via console.log().
     These skills are important for a web designer because they further help with organization. If a website had a list of videos the user could watch, it would be good to provide the total watch time so the user knew how long they would need to sit around. Calculating the total watch time by hand is tedious and error prone, and if new videos are added, it won't be accurate. Letting the JS do it for you makes putting the total watch time easier and since it adjusts to changes, you won't have to recalculate total watch times over and over again.

Comments

Popular Posts