In this activity, you will generate a comma-separated list of nouns and display it on a web page.
For example, this array:
const nouns = [`one`, `two`, `three`];Should be display on the page as a sentence in the following format:
One, Two and Three.- Create a function
handleItem()that accepts the (JS-created) arrayitem(the noun) as a parameter. - Inside
handleItem(), use.innerHTMLand the addition assignment operator (+=) (or another method of your choice) to create a comma-separated of nouns so that:- the first character of each noun is capitalized;
- each noun is separated by a comma;
- the last noun is separated by the word
and.
- Finally, using
Array.forEach(): invokehandleItem()for each item in the noun array to create your comma-separated list.