This activity focuses on outputting/manipulating strings and dates as content of HTML elements.
-
Download or fork/clone this Gist to your workspace.
-
Using the
Datemethods provided below, template literals and common string methods refactor the printed date to create a sentence with the following structure (but using the current date and time):You last accessed this page on Oct 8 at 8:45pm
-
Using the
paraElementvariable and your knowledge of strings and string methods to:- Count the number of characters in the paragraph;
- Count the number of words in the paragraph;
- Count the number of times "wizard" is mentioned in the paragraph.
-
Output each of the above counts in the
spanelements provided under "Paragraph Stats".
After completing Step 2, you may have found the Date object difficult to work with. You're not alone! Many libraries have been written to improve the experience of working with dates.
Try installing one or more of the following date libraries and repeat Step 2 above: