Lab 6 - Arrays & Objects
Challenge
For this assignment, we are learning how to use arrays and objects along with inserting functions and other various sort of data types into objects.
Problems
In this lab, I ran into way more problems than the previous one. For one, the first mistake was putting curly brackets instead of square brackets when making an array for myTransport. Of course, it was solved rather quickly after re-reading the assignment instructions. Another problem I ran into was when testing the object I created by having it output elements within it. When I tried outputting the age of the car, it instead sent me the function I created inside of the brackets. I checked up with my partner, Nicole, who had already troubleshooted the problem. Apparently you were supposed to put open and closed parentheses after the command and that would make it so that the function would actually function. I was perplexed as to how and why it worked that way but ultimately gave up on finding an answer (as I had already solved the problem anyways). Furthermore, I also ran into some trouble with outputting the array and object in console.log(""). The way I troubleshooted this issue was by inserting the necessary spacing between each index within the array and separating the object by calling each of its components out along with some spacing made with strings. I was able to achieve what I desired but the coding behind it left me feeling sort of troubled as it looked very complicated and cumbersome for such a simple output.
Results
Script Output
