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.
Prev | Home | Next |
SCRIPT.type | Up | <SCRIPT SRC="..."> |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |