Lab 30 Reflection

     Lab 30 was about creating a list of band names that were sorted in alphabetical order, the catch being we were not going to create the list in HTML initially but in JS. The only thing done in the HTML, besides setting up, was setting up a pair of <ul> tags but that was it. In the JS, I created an array with all the band names I was using. I created a function called strip that took a band name as a parameter and removed the words 'an' and 'the' from its name, to make it so the list was truly in alphabetical order. Then I called the .sort() method on my band name array to sort the entire array in alphabetical order. This sorted array was stored in a new variable called sortedBands. Finally, using DOM, each item in this new array was inserted into the <ul> I created from before, making the list viewable on the webpage.
     These skills are important to a web designer because they make sorting more efficient. If a company wants a webpage where you can see all members of the staff and it needs to be sorted in alphabetical order, having to sort manually can be time consuming, annoying, and error-prone. By using JS, however, manual sorting is not required as the computer will do it for you. As a result, you can create that webpage faster and not have to grind on sorting. It makes creating webpages involving and type of sorting faster and easier to make.

Comments

Popular Posts