Script Source Text (Definition)

The original source text that is interpreted and executed.

Availability:

ECMAScript edition - 2

JavaScript implementations that conform to ECMAScript are embodied as a source text that a human can read and edit in a programming environment or text editor. The text of the script source must be expressed using the lower 128 character entities in the Unicode version 2.0 character set.

You can use other Unicode characters but only within comments and string literals.

Any Unicode character can be represented with an escape sequence composed only of characters in the lower 128 range. The escape sequence follows the normal tradition of specifying the character value (in hex) using its numeric position within the character set, like this:

\u47AD

Within a comment, such an escaped Unicode character is effectively ignored while within a string literal, it contributes a single character to the string.

Although all the characters in a conforming script are Unicode, they are treated with any context dependent interpretation as specified in the Unicode standard. The value of a 16 bit character is sometimes called a code point.

In JavaScript, escape sequences inside comments are never interpreted. That's actually a good thing, because the \u000A escape sequence is a line terminator and if you had one and commented out the line suddenly your script would break.

See also:Comment, Escape sequence (\), Formal Parameter List, function( ... ) ..., Lexical convention, Script, Script fragment, Variable Declaration, Variable instantiation

Cross-references:

ECMA 262 edition 2 - section - 6

ECMA 262 edition 3 - section - 6