When delving further into JavaScript, we were introduced to arrays, or, for me, re-introduced. I’m glad I was reminded of these, as I forgot how useful/ vital they are for coding. It was definitely good to get a refresher on all the different methods you can use with arrays.
This week, I was challenged to complete the Fizz Buzz coding challenge. I started by using a while loop and storing each result in a list variable as a string. On my first attempt, I made a logic error where I accidentally reassigned x to “fizz”, “buzz”, or “fizz buzz” instead of adding these values to the list directly. This caused my list to stop at the first “fizz”, or 3, because x then became a string, and the code couldn’t iterate through the rest of the numbers.
In my second attempt, I used an array to store my list instead and stored each value by pushing them into the array after every iteration. This meant I no longer reassigned x, and my code became much cleaner and shorter. This process has taught me to take a step back and really focus on what I’m telling the code to do instead of just thinking about what I want it to do. My final code:
This week’s lecture was on interaction design. After the lecture, I kept thinking about Don Norman’s design principles, especially his affordance principle, which refers to an attribute of an object that allows people to know how to use it. A physical example of his affordance principle that was mentioned was handles or the lack of handles on doors, indicating whether you should push or pull them. A handle indicates that you should pull it, and a lack of one indicates that you should push it. I now think about this principle whenever I see doors with handles on both sides, which are all over my accommodation, and I get frustrated that they don’t follow this principle.