/the-static-web-sonnet

In class codealong

Primary LanguageJavaScript

Sonnet exercise

Setup

These commands are a helpful quick start. You may choose to ignore them completely and create your own directory structure. If you choose to use this recommendation, just copy the commands below. It doesn't matter what directory you are currently in.

mkdir -p ~/workspace/exercises/the-static-web/sonnet && cd $_
touch index.html
touch sonnet.js

Requirements

  1. Paste the code below into your HTML file.
  2. Take the contents of the sonnet div and place it in a variable.
  3. Find and output the starting position of the word "orphans".
  4. Output the number of characters in the sonnet.
  5. Replace the first occurance of the string "winter" with "yuletide".
  6. Replace all occurances of the string "the" with "a large".
  7. Set the content of the sonnet div with the new string.
<div id="sonnet">
How like a winter hath my absence been
From thee, the pleasure of the fleeting year!
What freezings have I felt, what dark days seen!
What old December's bareness everywhere!
And yet this time removed was summer's time;
The teeming autumn, big with rich increase,
Bearing the wanton burden of the prime,
Like widow'd wombs after their lords' decease:
Yet this abundant issue seemed to me
But hope of orphans, and unfathered fruit;
For summer and his pleasures wait on thee,
And, thou away, the very birds are mute:
   Or, if they sing, 'tis with so dull a cheer,
   That leaves look pale, dreading the winter's near.
</div>