2.3.1 Strings and String Concatenation
"this is a string" or 'this is a string'
Double quotes can hide single quotes; for example:
"I don't care"
And single quotes can hide double quotes; for example:
'He cried, "Ahoy!"'
Either way, the entire string is enclosed in a set of matching quotes.
Concatenation is caused when two strings are joined together. The plus (+) sign is used to concatenate strings; for example:
"hot" + "dog or "San Francisco" + "</br>"
For more information on strings, see Chapter 3, "The Building Blocks: Data Types, Literals, and Variables."
2.3.2 The write() and writeln() Methods
Method names are followed by a set of parentheses. They are used to hold the arguments. These are messages that will be sent to the methods, such as a string of text, the output of a function, or the results of a calculation. Without arguments, the write() and writeln() methods would have nothing to write.
document.write("Hello to you");
The writeln() method is essentially just like the write() method, except when the text is inserted within HTML <pre> or <xmp> tags, in which case writeln() will insert a newline at the end of the string. The HTML <pre> tag is used to enclose preformatted text. It results in "what you see is what you get." All spaces and linebreaks are rendered literally, in a monopitch typeface. The <xmp> tag is an obsolete HTML tag that functions much like the <pre> tag.