Lab 20 Reflection

     Lab 20 was similar to Lab 18 in that we were given a set of data that we had to filter based on specific attributes. In this case, the data was an array of objects containing information about certain people and the first thing we did was check whether at least one individual in the array was 19 years old. This was done by creating a variable that would be true when a person is 19 years old and using .some() method to go through the array to check to see if one person sets the variable to true. This result was logged in the console. A similar variable was created but this time seeing if all persons were 19 or older, an untrue statement which was also logged in the console. Finally, we were given an array of comments with an id property for each. There was a comment with a specific id we had to remove, something we did by looking for that id in the array, determining its index, and using the .splice() method to remove it from the array.
     These skills are important for a web designer because they help orgainize data on a web page. There could be many elements or objects that need to be maintained in a site which is tedious doing it soley by hand, however, using various JS methods can help reduce the work load. If a site monitors incoming orders, for example, and these orders are objects stored into an array, it can be hard to monitor them all by hand. Orders that are fulfilled should be cut from the array and having to look for each can be time consuming, however, using .splice() method and referring to specific properties of object make this less demanding.

Comments

Popular Posts