Hattie Times Website
Entry #6 (4/25):
This week, I was extremely successful with my forloop codesketch, creating a little whac-a-smiley-face mini game. I mostly copied the code from class time, but I understand how we created a div using javascript instead of html. Instead of creating a div in the body of the html script and styling it in the style section, one can do that using javascript instead! To start, we create a function entitled makeINSERT NAME HERE and then create a variable which we will point towards a div. Following this, we will add an id or class list to the variable and tell the computer to go into the document and identify this variable. Using javascript to create a div this way is particularly helpful if you want to create many, many, many copies of that same div. To do so, you can either set an interval for your function, meaning there will be a maximum number of divs created, or you can continuously add one div until your function reaches its maximum. To finish off this cool codesketch, complete with 5,000 smiley faces, I decided to add an event listener to this function, so the smiley faces could disappear when clicked on them. This worked marvelously.