E3 Preparing for WODs

14 Feb 2022

For the Invoice1 WOD, we had to create and display a sales invoice that contained five different products. We had to use variables to define the information for each product, such as item name, quantity of the product, price, extended price, as well as subtotal, tax, and grand total. We had to incorporate expressions to calculate the value for some of these variables. We also had to make these values dynamic in a table. We did this using template strings. The purpose of making these dynamic was so that if the variable showed up multiple times in the document and the value needed to be changed (such as item name, quantity, price, or tax), we would only have to change it in one spot and it would update the rest of the values that used that specific variable in other places in the document. This is much more convenient in order to avoid missing an instance of the variable or mistyping the value if we were to hard code everything.

Click here to view the WOD

The WOD took me two tries to complete. For the most part, my first attempt went pretty smoothly. The parts that came very easy to me was assigning everything to their variables, creating expressions, and identifying a template string. The part that slowed me down was when I had to make the table dynamic. I had a hard time remembering where exactly the document.write went, as I intially wrote document.write under the tr tag instead of directly under the script tag. Also, instead of putting ‘); directly after the /tr tag, I put the whole thing on one line, so it looked like this: document.write(‘ ‘); when it should’ve looked like this: document.write(‘ after the open script tag and ‘); after the closing tr tag (Not able to use backticks, so the single quotes represent backticks). Therefore, I ended up watching the screencast for this part. After doing so, I was able to complete the WOD a second time with an Rx time of about 15:30.

Usually, when I prepare for WODs, I review the readings and screencast. Therefore, this is what I did to prepare for Invoice1 WOD. I didn’t need much of a review when it came to setting variables, creating expressions, and identifying a string template, but it was a great refresher before starting.

Something that I could have done to better prepare for this WOD is to also review the lab. After completing the WOD, I realized that we also practiced these exercises together in class. If I had reviewed the lab, I probably would not have been confused on the document.write step and would have been able to do the WOD perfectly in one try. Therefore, this is something that I will definitely do differently for the next WOD.