Another Zipline Finished: Quote Generator
Another zipline from FreeCodeCamp bites the dust! In this challenge, the task was to create an app on codepen that displayed a random quote. It also had to have a button which displayed another quote and a 'tweet' button which allows a user to post the quote to twitter.
The way I went about completing the zipline was to first create an array that held every quote that could be displayed. When the 'New Quote' button is clicked, a random number (between 0 and the array length) is generated. The quote is then chosen from the array position of this random number. Using the .innerHTML command allowed the new quote to be displayed on the screen. The tweet button was a lot simpler then I thought it would be. All it does is opens a new window (using window.open) with the URL "https://twitter.com/intent/tweet?text="+quoteText+"&related=AnthonyBrunoAUS" (where quoteText is the quote, amazingly). The new window then shows a filled out tweet of the quote.
I found this zipline pretty enjoyable, if a bit easy. I actually found the previous task (Making a portfolio page) harder, probably because I'm not very good at presentation (yet!). If you want to see the completed product, press here! Or, have a look at the source code.