One large HTML body generating script.

Store the document's URL in str ...

and write as body content. The '+' operator can be used to concatenate strings. It's best to use single quotes for JavaScript, since double quotes are for HTML attribute values. It is permitted, however, to use double quotes.

'length' is one of the String object's properties ( and not a method, as in Java ).

Lookup the first slash in the string and return its position, given the first character is number zero.

Store part of the string from its first character, 0 (zero), up to ( not including ) the 'pos' position in 'str2'.

Lookup the last slash...

and store part of the string from its position through the end of the string in str2. So one argument, 'pos' , to the 'substring' method implies the rest of a string from the position indicated.

Since this is a string,...

this results in a string, too, not in a calculated addition.

To distill a number from a string, one function we can use is the 'parseInt' method.

Show the string's third character.

To have a single quote inside a string, escape it with a backslash, ditto for the backslash itself.