Valores, variáveis e literais

  • Revision slug: JavaScript/Guide/Values,_variables,_and_literals
  • Revision title: Values, variables, and literals
  • Revision id: 303453
  • Criado:
  • Criador: arielserafini
  • É a revisão atual? Não
  • Comentar

Conteúdo da revisão

Esse capítulo trata sobre os valores reconhecidos pelo JavaScript e descreve os componentens principais de expressões em JavaScript: variáveis, constantes e literais.

Valores

O JavaScript reconhece os seguintes tipos de valores:

  • Numbers, números como 42 ou 3.14159
  • Valores Boolean (booleanos), como true ou false
  • Strings, como "Olá!"
  • null, uma keyword especial que representa valores nulos; null também é um valor primitivo. Como JavaScript diferencia letras minúsculas de maiúsculas, null é diferente de Null, NULL, ou qualquer outra variação.
  • undefined, uma propriedade de alto nível cujo valor é indefinido; undefined também é um valor primitivo.

Esse conjunto de tipos de valores, ou tipos de dados, apesar de ser relativamente pequeno, possibilita diversas funções dentro de suas aplicações. Não existe diferenciação entre números inteiros (integers) ou reais. Além disso, não existe um tipo próprio para datas em JavaScript. No entanto, você pode usar o objeto Date e seus métodos para lidar com datas.

Objects e functions (objetos e funções) são os outros elementos fundamentais na linguagem. Objetos contém valores, e funções sãos os procedimentos que sua aplicação pode executar.

Conversão de tipos

JavaScript é uma linguagem dinamicamente tipada, ou seja, você não precisa especificar o tipo de uma variável ao declará-la, e tipos são automaticamente convertidos conforme necessário durante a execução do script. Por exemplo, podemos definir uma variável da seguinte forma:

var answer = 42;

Depois disso, você pode atribuir um valor do tipo string a essa mesma variável. Por exemplo:

answer = "Thanks for all the fish...";

Como JavaScript é uma linguagem dinamicamente tipada, essa atribuição não causa um erro.

Se uma expressão envolve números e strings usando o operador +, JavaScript converte valores numéricos em strings. Por exemplo, considere o código abaixo:

x = "The answer is " + 42 // retorna "The answer is 42"
y = 42 + " is the answer" // retorna "42 is the answer"

Em declarações usando outros operadores, JavaScript não converte valores numéricos em strings. Por exemplo:

"37" - 7 // retorna 30
"37" + 7 // retorna "377"

Convertendo strings em números

Quando um valor representando um número estiver em memória como uma string, existem alguns métodos para fazer a conversão.

parseInt() e parseFloat()

Veja as páginas referentes a parseInt() e parseFloat().

parseInt retorna somente números inteiros, não sendo tão útil ao lidar com decimais. Além disso, uma boa prática para usar parseInt é sempre incluir o parâmetro radix (base).

Operador de adição

Um método alternativo para se obter um número a partir de uma string é através do operador +.

"1.1" + "1.1" = "1.11.1"
(+"1.1") + (+"1.1") = 2.2   // Nota: os parênteses foram adicionados para tornar o código mais claro e não são necessários.

Variáveis

Você pode usar variáveis como nomes para simbolizar valores em sua aplicação. Nomes de variáveis, chamados de identifiers, devem seguir algumas regras.

Em JavaScript, um identifier deve começar com uma letra, um underscore (_) ou um cifrão ($); caracteres seguintes podem ser dígitos (0-9). Como JavaScript é uma linguagem que diferencia letras maiúsculas e minúsculas, as letras incluem os caracteres de "A" a "Z" (letras maíusculas) bem como os caracteres de "a" a "z" (letras minúsculas).

A partir do JavaScript 1.5, você pode usar letras ISO 8859-1 ou letras Unicode como å e ü em identifiers. Você também pode usar \uXXXX {{anch("Unicode escape sequences")}} como caracteres em identifiers.

Alguns exemplos de nomes permitidos são Number_hits, temp99, e _name.

Declarando variáveis

Existem duas maneiras de declarar variáveis:

  • Usando a keyword var. Por exemplo: var x = 42. Essa mesma sintaxe pode ser usada para definir variáveis locais e globais.
  • Simplesmente atribuindo um valor a ela. Por exemplo: x = 42. Isso define uma variável global e gera um aviso se você estiver utilizando o strict mode. Não declare variáveis desta maneira.

Interpretando variáveis

Uma variável declarada usando var sem receber um valor inicial tem o valor undefined.

Uma tentativa de acessar uma variável não declarada resultará em um ReferenceError:

var a;
console.log("The value of a is " + a); // exibe "The value of a is undefined"
console.log("The value of b is " + b); // resulta em um ReferenceError

Você pode usar undefined para determinar se uma variável possui um valor ou não. No código abaixo, a variável input não recebe um valor, e a declaração if tem valor true.

var input;
if(input === undefined){
  doThis();
} else {
  doThat();
}

O valor undefined comporta-se como false quando usado de forma booleana. Por exemplo, o código abaixo executa a função myFunction porque o elemento de myArray não foi definido:

var myArray = new Array();
if (!myArray[0]) myFunction(); 

O valor undefined é convertido em NaN quando usado em um contexto numérico.

var a;
a + 2 = NaN

Quando você interpreta uma variável nula, o valor nulo tem comportamento de 0 em um contexto numérico e de falso em um contexto booleano. Por exemplo:

var n = null;
console.log(n * 32); // exibe 0

Escopo de variáveis

When you declare a variable outside of any function, it is called a global variable, because it is available to any other code in the current document. When you declare a variable within a function, it is called a local variable, because it is available only within that function.

JavaScript does not have block statement scope; rather, it will be local to the code that the block resides within. For example the following code will log 5, because the scope of x is the function (or global context) within which x is declared, not the block, which in this case is an if statement.

if (true) {
  var x = 5;
}
console.log(x);

Another unusual thing about variables in JavaScript is that you can refer to a variable declared later, without getting an exception. This concept is known as hoisting; variables in JavaScript are in a sense "hoisted" or lifted to the top of the function or statement. However, variables that aren't initialized yet will return a value of undefined.

/**
 * Example 1
 */
console.log(x === undefined); // logs "true"
var x = 3;


/**
 * Example 2
 */
// will return a value of undefined
var myvar = "my value";

(function() {
  console.log(myvar); // undefined
  var myvar = "local value";
})();

Example 2, above, will be interpreted the same as:

var myvar = "my value";

(function() {
  var myvar;
  console.log(myvar); // undefined
  myvar = "local value";
})();

Because of hoisting, all var statements in a function should be placed as near to the top of the function as possible. This best practice increases the clarity of the code.

Global variables

Global variables are in fact properties of the global object. In web pages the global object is window, so you can set and access global variables using the window.variable syntax.

Consequently, you can access global variables declared in one window or frame from another window or frame by specifying the window or frame name. For example, if a variable called phoneNumber is declared in a FRAMESET document, you can refer to this variable from a child frame as parent.phoneNumber.

Constants

You can create a read-only, named constant with the const keyword. The syntax of a constant identifier is the same as for a variable identifier: it must start with a letter or underscore and can contain alphabetic, numeric, or underscore characters.

const prefix = '212';

A constant cannot change value through assignment or be re-declared while the script is running.

The scope rules for constants are the same as those for variables, except that the const keyword is always required, even for global constants. If the keyword is omitted, the identifier is assumed to represent a variable.

You cannot declare a constant with the same name as a function or variable in the same scope. For example:

// THIS WILL CAUSE AN ERROR
function f() {};
const f = 5;

// THIS WILL CAUSE AN ERROR ALSO
function f() {
  const g = 5;
  var g;

  //statements
}

Literals

You use literals to represent values in JavaScript. These are fixed values, not variables, that you literally provide in your script. This section describes the following types of literals:

  • {{anch("Array literals")}}
  • {{anch("Boolean literals")}}
  • {{anch("Floating-point literals")}}
  • {{anch("Integers")}}
  • {{anch("Object literals")}}
  • {{anch("String literals")}}

Array literals

An array literal is a list of zero or more expressions, each of which represents an array element, enclosed in square brackets ([]). When you create an array using an array literal, it is initialized with the specified values as its elements, and its length is set to the number of arguments specified.

The following example creates the coffees array with three elements and a length of three:

var coffees = ["French Roast", "Colombian", "Kona"];

Note An array literal is a type of object initializer. See Using Object Initializers.

If an array is created using a literal in a top-level script, JavaScript interprets the array each time it evaluates the expression containing the array literal. In addition, a literal used in a function is created each time the function is called.

Array literals are also Array objects. See Array Object for details on Array objects.

Extra commas in array literals

You do not have to specify all elements in an array literal. If you put two commas in a row, the array is created with undefined for the unspecified elements. The following example creates the fish array:

var fish = ["Lion", , "Angel"];

This array has two elements with values and one empty element (fish[0] is "Lion", fish[1] is undefined, and fish[2] is "Angel").

If you include a trailing comma at the end of the list of elements, the comma is ignored. In the following example, the length of the array is three. There is no myList[3]. All other commas in the list indicate a new element. (Note trailing commas can create errors in older browser versions and it is a best practice to remove them)

var myList = ['home', , 'school', ];

In the following example, the length of the array is four, and myList[0] and myList[2] are missing.

var myList = [ , 'home', , 'school'];

In the following example, the length of the array is four, and myList[1] and myList[3] are missing. Only the last comma is ignored.

var myList = ['home', , 'school', , ];

Understanding the behavior of extra commas is important to understanding JavaScript as a language, however when writing your own code: explicitly declaring the missing elements as undefined will increase your code's clarity and maintainability.

Boolean literals

The Boolean type has two literal values: true and false.

Do not confuse the primitive Boolean values true and false with the true and false values of the Boolean object. The Boolean object is a wrapper around the primitive Boolean data type. See Boolean Object for more information.

Integers

Integers can be expressed in decimal (base 10), hexadecimal (base 16), and octal (base 8).

  • Decimal integer literal consists of a sequence of digits without a leading 0 (zero).
  • Leading 0 (zero) on an integer literal indicates it is in octal. Octal integers can include only the digits 0-7.
  • Leading 0x (or 0X) indicates hexadecimal. Hexadecimal integers can include digits (0-9) and the letters a-f and A-F.

Octal integer literals are deprecated and have been removed from the ECMA-262, Edition 3 standard (in strict mode). JavaScript 1.5 still supports them for backward compatibility.

Some examples of integer literals are:

0, 117 and -345 (decimal, base 10)
015, 0001 and -077 (octal, base 8) 
0x1123, 0x00111 and -0xF1A7 (hexadecimal, "hex" or base 16)

Floating-point literals

A floating-point literal can have the following parts:

  • A decimal integer which can be signed (preceded by "+" or "-"),
  • A decimal point ("."),
  • A fraction (another decimal number),
  • An exponent.

The exponent part is an "e" or "E" followed by an integer, which can be signed (preceded by "+" or "-"). A floating-point literal must have at least one digit and either a decimal point or "e" (or "E").

Some examples of floating-point literals are 3.1415, -3.1E12, .1e12, and 2E-12.

More succinctly, the syntax is:

[digits][.digits][(E|e)[(+|-)]digits]

For example:

3.14
2345.789
.3333333333333333333

Object literals

An object literal is a list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ({}). You should not use an object literal at the beginning of a statement. This will lead to an error or not behave as you expect, because the { will be interpreted as the beginning of a block.

The following is an example of an object literal. The first element of the car object defines a property, myCar; the second element, the getCar property, invokes a function (CarTypes("Honda")); the third element, the special property, uses an existing variable (Sales).

var Sales = "Toyota";

function CarTypes(name) {
  return (name == "Honda") ?
    name :
    "Sorry, we don't sell " + name + "." ;
}

var car = { myCar: "Saturn", getCar: CarTypes("Honda"), special: Sales };

console.log(car.myCar);   // Saturn
console.log(car.getCar);  // Honda
console.log(car.special); // Toyota 

Additionally, you can use a numeric or string literal for the name of a property or nest an object inside another. The following example uses these options.

var car = { manyCars: {a: "Saab", "b": "Jeep"}, 7: "Mazda" };

console.log(car.manyCars.b); // Jeep
console.log(car[7]); // Mazda

Please note:

var foo = {a: "alpha", 2: "two"};
console.log(foo.a);    // alpha
console.log(foo[2]);   // two
//console.log(foo.2);  // Error: missing ) after argument list
//console.log(foo[a]); // Error: a is not defined
console.log(foo["a"]); // alpha
console.log(foo["2"]); // two

String literals

A string literal is zero or more characters enclosed in double (") or single (') quotation marks. A string must be delimited by quotation marks of the same type; that is, either both single quotation marks or both double quotation marks. The following are examples of string literals:

  • "foo"
  • 'bar'
  • "1234"
  • "one line \n another line"
  • "John's cat"

You can call any of the methods of the String object on a string literal value—JavaScript automatically converts the string literal to a temporary String object, calls the method, then discards the temporary String object. You can also use the String.length property with a string literal:

"John's cat".length

You should use string literals unless you specifically need to use a String object. See String Object for details on String objects.

Using special characters in strings

In addition to ordinary characters, you can also include special characters in strings, as shown in the following example.

"one line \n another line"

The following table lists the special characters that you can use in JavaScript strings.

Table 2.1 JavaScript special characters
Character Meaning
\b Backspace
\f Form feed
\n New line
\r Carriage return
\t Tab
\v Vertical tab
\' Apostrophe or single quote
\" Double quote
\\ Backslash character (\).
\XXX The character with the Latin-1 encoding specified by up to three octal digits XXX between 0 and 377. For example, \251 is the octal sequence for the copyright symbol.
\xXX The character with the Latin-1 encoding specified by the two hexadecimal digits XX between 00 and FF. For example, \xA9 is the hexadecimal sequence for the copyright symbol.
\uXXXX The Unicode character specified by the four hexadecimal digits XXXX. For example, \u00A9 is the Unicode sequence for the copyright symbol. See {{anch("Unicode escape sequences")}}.

Escaping characters

For characters not listed in Table 2.1, a preceding backslash is ignored, but this usage is deprecated and should be avoided.

You can insert a quotation mark inside a string by preceding it with a backslash. This is known as escaping the quotation mark. For example:

var quote = "He read \"The Cremation of Sam McGee\" by R.W. Service.";
console.log(quote);

The result of this would be:

He read "The Cremation of Sam McGee" by R.W. Service.

To include a literal backslash inside a string, you must escape the backslash character. For example, to assign the file path c:\temp to a string, use the following:

var home = "c:\\temp";

You can also escape line breaks by preceding them with backslash. The backslash and line break are both removed from the value of the string.

var str = "this string \
is broken \
across multiple\
lines."
console.log(str);   // this string is broken across multiplelines.

Although JavaScript does not have "heredoc" syntax, you can get close by adding a linebreak escape and an escaped linebreak at the end of each line:

var poem = 
"Roses are red,\n\
Violets are blue.\n\
I'm schizophrenic,\n\
And so am I."

Unicode

Unicode is a universal character-coding standard for the interchange and display of principal written languages. It covers the languages of the Americas, Europe, Middle East, Africa, India, Asia, and Pacifica, as well as historic scripts and technical symbols. Unicode allows for the exchange, processing, and display of multilingual texts, as well as the use of common technical and mathematical symbols. It hopes to resolve internationalization problems of multilingual computing, such as different national character standards. Not all modern or archaic scripts, however, are currently supported.

The Unicode character set can be used for all known encoding. Unicode is modeled after the ASCII (American Standard Code for Information Interchange) character set. It uses a numerical value and name for each character. The character encoding specifies the identity of the character and its numeric value (code position), as well as the representation of this value in bits. The 16-bit numeric value (code value) is defined by a hexadecimal number and a prefix U, for example, U+0041 represents A. The unique name for this value is LATIN CAPITAL LETTER A.

Unicode is not supported in versions of JavaScript prior to 1.3.

Unicode compatibility with ASCII and ISO

Unicode is fully compatible with the International Standard ISO/IEC 10646-1; 1993, which is a subset of ISO 10646.

Several encoding standards (including UTF-8, UTF-16 and ISO UCS-2) are used to physically represent Unicode as actual bits.

The UTF-8 encoding of Unicode is compatible with ASCII characters and is supported by many programs. The first 128 Unicode characters correspond to the ASCII characters and have the same byte value. The Unicode characters U+0020 through U+007E are equivalent to the ASCII characters 0x20 through 0x7E. Unlike ASCII, which supports the Latin alphabet and uses a 7-bit character set, UTF-8 uses between one and four octets for each character ("octet" meaning a byte, or 8 bits.) This allows for several million characters. An alternative encoding standard, UTF-16, uses two octets to represent Unicode characters. An escape sequence allows UTF-16 to represent the whole Unicode range by using four octets. The ISO UCS-2 (Universal Character Set) uses two octets.

JavaScript and Navigator support for UTF-8/Unicode means you can use non-Latin, international, and localized characters, plus special technical symbols in JavaScript programs. Unicode provides a standard way to encode multilingual text. Since the UTF-8 encoding of Unicode is compatible with ASCII, programs can use ASCII characters. You can use non-ASCII Unicode characters in the comments, string literals, identifiers, and regular expressions of JavaScript.

Unicode escape sequences

You can use the Unicode escape sequence in string literals, regular expressions, and identifiers. The escape sequence consists of six ASCII characters: \u and a four-digit hexadecimal number. For example, \u00A9 represents the copyright symbol. Every Unicode escape sequence in JavaScript is interpreted as one character.

The following code returns the copyright symbol and the string "Netscape Communications".

var x = "\u00A9 Netscape Communications";

The following table lists frequently used special characters and their Unicode value.

Table 2.2 Unicode values for special characters
Category Unicode value Name Format name
White space values \u0009 Tab <TAB>
\u000B Vertical Tab <VT>
\u000C Form Feed <FF>
\u0020 Space <SP>
Line terminator values \u000A Line Feed <LF>
\u000D Carriage Return <CR>
Additional Unicode escape sequence values \u0008 Backspace <BS>
\u0009 Horizontal Tab <HT>
\u0022 Double Quote "
\u0027 Single Quote '
\u005C Backslash \

The JavaScript use of the Unicode escape sequence is different from Java. In JavaScript, the escape sequence is never interpreted as a special character first. For example, a line terminator escape sequence inside a string does not terminate the string before it is interpreted by the function. JavaScript ignores any escape sequence if it is used in comments. In Java, if an escape sequence is used in a single comment line, it is interpreted as an Unicode character. For a string literal, the Java compiler interprets the escape sequences first. For example, if a line terminator escape character (e.g., \u000A) is used in Java, it terminates the string literal. In Java, this leads to an error, because line terminators are not allowed in string literals. You must use \n for a line feed in a string literal. In JavaScript, the escape sequence works the same way as \n.

Unicode characters in JavaScript files

Earlier versions of Gecko assumed the Latin-1 character encoding for JavaScript files loaded from XUL. Starting with Gecko 1.8, the character encoding is inferred from the XUL file's encoding. Please see International characters in XUL JavaScript for more information.

Displaying characters with Unicode

You can use Unicode to display the characters in different languages or technical symbols. For characters to be displayed properly, a client such as Mozilla Firefox or Netscape needs to support Unicode. Moreover, an appropriate Unicode font must be available to the client, and the client platform must support Unicode. Often, Unicode fonts do not display all the Unicode characters. Some platforms, such as Windows 95, provide partial support for Unicode.

To receive non-ASCII character input, the client needs to send the input as Unicode. Using a standard enhanced keyboard, the client cannot easily input the additional characters supported by Unicode. Sometimes, the only way to input Unicode characters is by using Unicode escape sequences.

For more information on Unicode, see the Unicode Home Page and The Unicode Standard, Version 2.0, published by Addison-Wesley, 1996.

Resources

{{autoPreviousNext("JSGChapters")}}

Fonte da revisão

<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Esse capítulo trata sobre os valores reconhecidos pelo JavaScript e descreve os componentens principais de expressões em JavaScript: variáveis, constantes e literais.</p>
<h2 id="Valores" style="font-size: 1.428em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Valores</h2>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">O JavaScript reconhece os seguintes tipos de valores:</p>
<ul style="margin: 0px 0px 1.286em; padding: 0px 0px 0px 22px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
  <li><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Number" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Reference/Global Objects/Number">Numbers</a>, números como 42 ou 3.14159</li>
  <li>Valores <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Reference/Global Objects/Boolean">Boolean</a> (booleanos), como&nbsp;<code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">true</code><span class="Apple-converted-space">&nbsp;</span>ou&nbsp;<code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">false</code></li>
  <li><a href="/en-US/docs/JavaScript/Reference/Global_Objects/String" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Reference/Global Objects/String">Strings</a>, como "Olá!"</li>
  <li><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">null</code>, uma keyword especial que representa valores nulos;<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">null</code><span class="Apple-converted-space">&nbsp;</span>também é um valor primitivo. Como JavaScript diferencia letras minúsculas de maiúsculas,<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">null</code><span class="Apple-converted-space">&nbsp;</span>é diferente de&nbsp;<code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">Null</code>,<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">NULL</code>, ou qualquer outra variação.</li>
  <li><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; "><a href="/en-US/docs/JavaScript/Reference/Global_Objects/undefined" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Reference/Global Objects/undefined">undefined</a></code>, uma propriedade de alto nível cujo valor é indefinido;<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">undefined</code>&nbsp;também é um valor primitivo.</li>
</ul>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Esse conjunto de tipos de valores, ou tipos de dados, apesar de ser relativamente pequeno, possibilita diversas funções dentro de suas aplicações. Não existe diferenciação entre números inteiros (<em>integers</em>) ou reais. Além disso, não existe um tipo próprio para datas em JavaScript. No entanto, você pode usar o objeto&nbsp;<code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; "><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Date" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Reference/Global Objects/Date">Date</a></code><span class="Apple-converted-space"> </span>e seus métodos para lidar com datas.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Reference/Global Objects/Object">Objects</a><span class="Apple-converted-space"> e</span><span class="Apple-converted-space"> </span><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Reference/Global Objects/Function">functions</a><span class="Apple-converted-space"> (objetos e funções) são os outros elementos fundamentais na linguagem.</span> Objetos contém valores, e funções sãos os procedimentos que sua aplicação pode executar.</p>
<h3 id="Convers.C3.A3o_de_tipos" style="font-size: 1.142em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Conversão de tipos</h3>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">JavaScript é uma linguagem dinamicamente tipada, ou seja, você não precisa especificar o tipo de uma variável ao declará-la, e tipos são automaticamente convertidos conforme necessário durante a execução do <em>script</em>. Por exemplo, podemos definir uma variável da seguinte forma:</p>
<div style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; overflow: hidden; ">
  <pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; ">
var answer = 42;
</pre>
</div>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Depois disso, você pode atribuir um valor do tipo <em>string</em> a essa mesma variável. Por exemplo:</p>
<div style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; overflow: hidden; ">
  <pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; ">
answer = "Thanks for all the fish...";
</pre>
</div>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Como JavaScript é uma linguagem dinamicamente tipada, essa atribuição não causa um erro.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Se uma expressão envolve números e <em>strings</em> usando o operador +, JavaScript converte valores numéricos em <em>strings</em>. Por exemplo, considere o código abaixo:</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
x = "The answer is " + 42 // retorna "The answer is 42"
y = 42 + " is the answer" // retorna "42 is the answer"
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Em declarações usando outros operadores, JavaScript não converte valores numéricos em <em>strings</em>. Por exemplo:</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
"37" - 7 // retorna 30
"37" + 7 // retorna "377"
</pre>
<h3 id="Convertendo_strings_em_n.C3.BAmeros" style="font-size: 1.142em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Convertendo <em>strings</em> em números</h3>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Quando um valor representando um número estiver em memória como uma <em>string</em>, existem alguns métodos para fazer a conversão.</p>
<h4 id="parseInt()_e_parseFloat()" style="font-size: 14px; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">parseInt()</code><span class="Apple-converted-space"> e</span><span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">parseFloat()</code></h4>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Veja as páginas referentes a<span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; "><a href="/en-US/docs/JavaScript/Reference/Global_Objects/parseInt" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Reference/Global Objects/parseInt">parseInt()</a></code><span class="Apple-converted-space"> e</span><span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; "><a href="/en-US/docs/JavaScript/Reference/Global_Objects/parseFloat" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Reference/Global Objects/parseFloat">parseFloat()</a></code><span class="Apple-converted-space">.</span></p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">parseInt</code><span class="Apple-converted-space"> </span>retorna somente números inteiros, não sendo tão útil ao lidar com decimais. Além disso, uma boa prática para usar<span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">parseInt</code><span class="Apple-converted-space"> </span>é sempre incluir o parâmetro radix (base).</p>
<h4 id="Operador_de_adi.C3.A7.C3.A3o" style="font-size: 14px; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Operador de adição</h4>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Um método alternativo para se obter um número a partir de uma <em>string</em> é através do operador +.</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
"1.1" + "1.1" = "1.11.1"
(+"1.1") + (+"1.1") = 2.2   // Nota: os parênteses foram adicionados para tornar o código mais claro e não são necessários.</pre>
<h2 id="Vari.C3.A1veis" style="font-size: 1.428em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Variáveis</h2>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Você pode usar variáveis como nomes para simbolizar valores em sua aplicação. Nomes de variáveis, chamados de <em>identifiers</em>, devem seguir algumas regras.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Em JavaScript, um <em>identifier</em> deve começar com uma letra, um <em>underscore</em> (_) ou um cifrão ($); caracteres seguintes podem ser dígitos (0-9). Como JavaScript é uma linguagem que diferencia letras maiúsculas e minúsculas, as letras incluem os caracteres de "A" a "Z" (letras maíusculas) bem como os caracteres de "a" a "z" (letras minúsculas).</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">A partir do JavaScript 1.5, você pode usar letras ISO 8859-1 ou letras Unicode como å e ü em <em>identifiers</em>. Você também pode usar \uXXXX {{anch("Unicode escape sequences")}} como caracteres em <em>identifiers</em>.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Alguns exemplos de nomes permitidos são<span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">Number_hits</code>,<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">temp99</code>, e<span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">_name</code>.</p>
<h3 id="Declaring_variables" style="font-size: 1.142em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Declarando variáveis</h3>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Existem duas maneiras de declarar variáveis:</p>
<ul style="margin: 0px 0px 1.286em; padding: 0px 0px 0px 22px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
  <li>Usando a <em>keyword</em><span class="Apple-converted-space"> </span><a href="/en-US/docs/JavaScript/Reference/Statements/var" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Reference/Statements/var">var</a>. Por exemplo:<span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">var x = 42</code>. Essa mesma sintaxe pode ser usada para definir variáveis<span class="Apple-converted-space"> </span><a href="#Variable_Scope" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; ">locais e globais</a>.</li>
  <li>Simplesmente atribuindo um valor a ela. Por exemplo:<span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">x = 42</code>. Isso define uma<span class="Apple-converted-space"> </span><a href="#Global_Variables" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; ">variável global</a><span class="Apple-converted-space"> </span>e gera um aviso se você estiver utilizando o <em>strict mode</em>. Não declare variáveis desta maneira.</li>
</ul>
<h3 id="Evaluating_variables" style="font-size: 1.142em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Interpretando variáveis</h3>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Uma variável declarada usando <code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">var</code><span class="Apple-converted-space"> sem receber um valor inicial</span><span class="Apple-converted-space"> tem o valor </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; "><a href="/en-US/docs/JavaScript/Reference/Global_Objects/undefined" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Reference/Global Objects/undefined">undefined</a></code>.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Uma tentativa de acessar uma variável não declarada resultará em um<span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">ReferenceError</code>:</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var a;
console.log("The value of a is " + a); // exibe "The value of a is undefined"
console.log("The value of b is " + b); // resulta em um ReferenceError
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Você pode usar<span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">undefined</code><span class="Apple-converted-space"> para determinar se uma variável possui um valor ou não</span>. No código abaixo, a variável<span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">input</code><span class="Apple-converted-space"> não recebe um valor, e a declaração</span><span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; "><a href="/en-US/docs/JavaScript/Reference/Statements/if...else" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Reference/Statements/if...else">if</a></code><span class="Apple-converted-space"> tem valor</span><span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">true</code>.</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var input;
if(input === undefined){
  doThis();
} else {
  doThat();
}
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">O valor<span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">undefined</code><span class="Apple-converted-space"> comporta-se como</span><span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">false</code><span class="Apple-converted-space"> quando usado de forma booleana</span>. Por exemplo, o código abaixo executa a função<span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">myFunction</code><span class="Apple-converted-space"> porque</span><span class="Apple-converted-space"> o elemento de </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">myArray</code><span class="Apple-converted-space"> não foi definido</span>:</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var myArray = new Array();
if (!myArray[0]) myFunction(); 
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-converted-space">O valor </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">undefined</code><span class="Apple-converted-space"> </span>é convertido em<span class="Apple-converted-space"> </span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">NaN</code><span class="Apple-converted-space"> quando usado em um contexto numérico</span>.</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var a;
a + 2 = NaN</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Quando você interpreta uma variável nula, o valor nulo tem comportamento de 0 em um contexto numérico e de falso em um contexto booleano. Por exemplo:</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var n = null;
console.log(n * 32); // exibe 0
</pre>
<h3 id="Variable_scope" style="font-size: 1.142em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Escopo de variáveis</h3>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">When you declare a variable outside of any function, it is called a<span class="Apple-converted-space">&nbsp;</span><em>global</em><span class="Apple-converted-space">&nbsp;</span>variable, because it is available to any other code in the current document. When you declare a variable within a function, it is called a<span class="Apple-converted-space">&nbsp;</span><em>local</em><span class="Apple-converted-space">&nbsp;</span>variable, because it is available only within that function.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">JavaScript does not have<span class="Apple-converted-space">&nbsp;</span><a href="/en-US/docs/JavaScript/Guide/Statements#Block_Statement" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Guide/Statements#Block Statement">block statement</a><span class="Apple-converted-space">&nbsp;</span>scope; rather, it will be local to the code that the block resides within. For example the following code will log<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">5</code>, because the scope of<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">x</code><span class="Apple-converted-space">&nbsp;</span>is the function (or global context) within which<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">x</code><span class="Apple-converted-space">&nbsp;</span>is declared, not the block, which in this case is an<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">if</code><span class="Apple-converted-space">&nbsp;</span>statement.</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
if (true) {
  var x = 5;
}
console.log(x);
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Another unusual thing about variables in JavaScript is that you can refer to a variable declared later, without getting an exception. This concept is known as hoisting; variables in JavaScript are in a sense "hoisted" or lifted to the top of the function or statement. However, variables that aren't initialized yet will return a value of<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">undefined</code>.</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
/**
 * Example 1
 */
console.log(x === undefined); // logs "true"
var x = 3;


/**
 * Example 2
 */
// will return a value of undefined
var myvar = "my value";

(function() {
  console.log(myvar); // undefined
  var myvar = "local value";
})();
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Example 2, above, will be interpreted the same as:</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var myvar = "my value";

(function() {
  var myvar;
  console.log(myvar); // undefined
  myvar = "local value";
})();</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Because of hoisting, all<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">var</code><span class="Apple-converted-space">&nbsp;</span>statements in a function should be placed as near to the top of the function as possible. This best practice increases the clarity of the code.</p>
<h3 id="Global_variables" style="font-size: 1.142em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Global variables</h3>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Global variables are in fact properties of the<span class="Apple-converted-space">&nbsp;</span><em>global object</em>. In web pages the global object is<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; "><a href="/en-US/docs/DOM/window" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/DOM/window">window</a></code>, so you can set and access global variables using the<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">window.<em>variable</em></code><span class="Apple-converted-space">&nbsp;</span>syntax.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Consequently, you can access global variables declared in one window or frame from another window or frame by specifying the window or frame name. For example, if a variable called<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">phoneNumber</code><span class="Apple-converted-space">&nbsp;</span>is declared in a<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">FRAMESET</code><span class="Apple-converted-space">&nbsp;</span>document, you can refer to this variable from a child frame as<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">parent.phoneNumber</code>.</p>
<h2 id="Constants" style="font-size: 1.428em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Constants</h2>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">You can create a read-only, named constant with the<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; "><a href="/en-US/docs/JavaScript/Reference/Statements/const" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Reference/Statements/const">const</a></code><span class="Apple-converted-space">&nbsp;</span>keyword. The syntax of a constant identifier is the same as for a variable identifier: it must start with a letter or underscore and can contain alphabetic, numeric, or underscore characters.</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
const prefix = '212';
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">A constant cannot change value through assignment or be re-declared while the script is running.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">The scope rules for constants are the same as those for variables, except that the<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">const</code><span class="Apple-converted-space">&nbsp;</span>keyword is always required, even for global constants. If the keyword is omitted, the identifier is assumed to represent a variable.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">You cannot declare a constant with the same name as a function or variable in the same scope. For example:</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
// THIS WILL CAUSE AN ERROR
function f() {};
const f = 5;

// THIS WILL CAUSE AN ERROR ALSO
function f() {
  const g = 5;
  var g;

  //statements
}
</pre>
<h2 id="Literals" style="font-size: 1.428em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Literals</h2>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">You use literals to represent values in JavaScript. These are fixed values, not variables, that you<span class="Apple-converted-space">&nbsp;</span><em>literally</em><span class="Apple-converted-space">&nbsp;</span>provide in your script. This section describes the following types of literals:</p>
<ul style="margin: 0px 0px 1.286em; padding: 0px 0px 0px 22px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
  <li>{{anch("Array literals")}}</li>
  <li>{{anch("Boolean literals")}}</li>
  <li>{{anch("Floating-point literals")}}</li>
  <li>{{anch("Integers")}}</li>
  <li>{{anch("Object literals")}}</li>
  <li>{{anch("String literals")}}</li>
</ul>
<h3 id="Array_literals" style="font-size: 1.142em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Array literals</h3>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">An array literal is a list of zero or more expressions, each of which represents an array element, enclosed in square brackets ([]). When you create an array using an array literal, it is initialized with the specified values as its elements, and its length is set to the number of arguments specified.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">The following example creates the<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">coffees</code><span class="Apple-converted-space">&nbsp;</span>array with three elements and a length of three:</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var coffees = ["French Roast", "Colombian", "Kona"];
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><strong>Note</strong><span class="Apple-converted-space">&nbsp;</span>An array literal is a type of object initializer. See<span class="Apple-converted-space">&nbsp;</span><a href="/en-US/docs/JavaScript/Guide/Working_with_Objects#Using_Object_Initializers" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Guide/Working with Objects#Using Object Initializers">Using Object Initializers</a>.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">If an array is created using a literal in a top-level script, JavaScript interprets the array each time it evaluates the expression containing the array literal. In addition, a literal used in a function is created each time the function is called.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Array literals are also<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">Array</code><span class="Apple-converted-space">&nbsp;</span>objects. See<span class="Apple-converted-space">&nbsp;</span><a href="/en-US/docs/JavaScript/Guide/Predefined_Core_Objects#Array_Object" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Guide/Predefined Core Objects#Array Object">Array Object</a><span class="Apple-converted-space">&nbsp;</span>for details on<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">Array</code><span class="Apple-converted-space">&nbsp;</span>objects.</p>
<h4 id="Extra_commas_in_array_literals" style="font-size: 14px; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Extra commas in array literals</h4>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">You do not have to specify all elements in an array literal. If you put two commas in a row, the array is created with<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">undefined</code><span class="Apple-converted-space">&nbsp;</span>for the unspecified elements. The following example creates the<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">fish</code><span class="Apple-converted-space">&nbsp;</span>array:</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var fish = ["Lion", , "Angel"];
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">This array has two elements with values and one empty element (<code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">fish[0]</code><span class="Apple-converted-space">&nbsp;</span>is "Lion",<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">fish[1]</code><span class="Apple-converted-space">&nbsp;</span>is<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">undefined</code>, and<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">fish[2]</code><span class="Apple-converted-space">&nbsp;</span>is "Angel").</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">If you include a trailing comma at the end of the list of elements, the comma is ignored. In the following example, the length of the array is three. There is no<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">myList[3]</code>. All other commas in the list indicate a new element. (<strong>Note</strong><span class="Apple-converted-space">&nbsp;</span>trailing commas can create errors in older browser versions and it is a best practice to remove them)</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var myList = ['home', , 'school', ];
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">In the following example, the length of the array is four, and<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">myList[0]</code><span class="Apple-converted-space">&nbsp;</span>and<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">myList[2]</code><span class="Apple-converted-space">&nbsp;</span>are missing.</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var myList = [ , 'home', , 'school'];
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">In the following example, the length of the array is four, and<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">myList[1]</code><span class="Apple-converted-space">&nbsp;</span>and<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">myList[3]</code><span class="Apple-converted-space">&nbsp;</span>are missing. Only the last comma is ignored.</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var myList = ['home', , 'school', , ];
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Understanding the behavior of extra commas is important to understanding JavaScript as a language, however when writing your own code: explicitly declaring the missing elements as<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">undefined</code><span class="Apple-converted-space">&nbsp;</span>will increase your code's clarity and maintainability.</p>
<h3 id="Boolean_literals" style="font-size: 1.142em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Boolean literals</h3>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">The Boolean type has two literal values:<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">true</code><span class="Apple-converted-space">&nbsp;</span>and<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">false</code>.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Do not confuse the primitive Boolean values<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">true</code><span class="Apple-converted-space">&nbsp;</span>and<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">false</code><span class="Apple-converted-space">&nbsp;</span>with the true and false values of the Boolean object. The Boolean object is a wrapper around the primitive Boolean data type. See<span class="Apple-converted-space">&nbsp;</span><a href="/en-US/docs/JavaScript/Guide/Predefined_Core_Objects#Boolean_Object" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Guide/Predefined Core Objects#Boolean Object">Boolean Object</a><span class="Apple-converted-space">&nbsp;</span>for more information.</p>
<h3 id="Integers" style="font-size: 1.142em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Integers</h3>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Integers can be expressed in decimal (base 10), hexadecimal (base 16), and octal (base 8).</p>
<ul style="margin: 0px 0px 1.286em; padding: 0px 0px 0px 22px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
  <li>Decimal integer literal consists of a sequence of digits without a leading 0 (zero).</li>
  <li>Leading 0 (zero) on an integer literal indicates it is in octal. Octal integers can include only the digits 0-7.</li>
  <li>Leading 0x (or 0X) indicates hexadecimal. Hexadecimal integers can include digits (0-9) and the letters a-f and A-F.</li>
</ul>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Octal integer literals are deprecated and have been removed from the ECMA-262, Edition 3 standard (in<span class="Apple-converted-space">&nbsp;</span><em>strict mode</em>). JavaScript 1.5 still supports them for backward compatibility.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Some examples of integer literals are:</p>
<pre class="eval" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
0, 117 and -345 (decimal, base 10)
015, 0001 and -077 (octal, base 8) 
0x1123, 0x00111 and -0xF1A7 (hexadecimal, "hex" or base 16)
</pre>
<h3 id="Floating-point_literals" style="font-size: 1.142em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Floating-point literals</h3>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">A floating-point literal can have the following parts:</p>
<ul style="margin: 0px 0px 1.286em; padding: 0px 0px 0px 22px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
  <li>A decimal integer which can be signed (preceded by "+" or "-"),</li>
  <li>A decimal point ("."),</li>
  <li>A fraction (another decimal number),</li>
  <li>An exponent.</li>
</ul>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">The exponent part is an "e" or "E" followed by an integer, which can be signed (preceded by "+" or "-"). A floating-point literal must have at least one digit and either a decimal point or "e" (or "E").</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Some examples of floating-point literals are 3.1415, -3.1E12, .1e12, and 2E-12.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">More succinctly, the syntax is:</p>
<pre class="eval" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
[digits][.digits][(E|e)[(+|-)]digits]
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">For example:</p>
<pre class="eval" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
3.14
2345.789
.3333333333333333333
</pre>
<h3 id="Object_literals" style="font-size: 1.142em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Object literals</h3>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">An object literal is a list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ({}). You should not use an object literal at the beginning of a statement. This will lead to an error or not behave as you expect, because the { will be interpreted as the beginning of a block.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">The following is an example of an object literal. The first element of the<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">car</code><span class="Apple-converted-space">&nbsp;</span>object defines a property,<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">myCar</code>; the second element, the<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">getCar</code><span class="Apple-converted-space">&nbsp;</span>property, invokes a function<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">(CarTypes("Honda"));</code><span class="Apple-converted-space">&nbsp;</span>the third element, the<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">special</code><span class="Apple-converted-space">&nbsp;</span>property, uses an existing variable (<code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">Sales</code>).</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var Sales = "Toyota";

function CarTypes(name) {
  return (name == "Honda") ?
    name :
    "Sorry, we don't sell " + name + "." ;
}

var car = { myCar: "Saturn", getCar: CarTypes("Honda"), special: Sales };

console.log(car.myCar);   // Saturn
console.log(car.getCar);  // Honda
console.log(car.special); // Toyota 
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Additionally, you can use a numeric or string literal for the name of a property or nest an object inside another. The following example uses these options.</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var car = { manyCars: {a: "Saab", "b": "Jeep"}, 7: "Mazda" };

console.log(car.manyCars.b); // Jeep
console.log(car[7]); // Mazda
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Please note:</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var foo = {a: "alpha", 2: "two"};
console.log(foo.a);    // alpha
console.log(foo[2]);   // two
//console.log(foo.2);  // Error: missing ) after argument list
//console.log(foo[a]); // Error: a is not defined
console.log(foo["a"]); // alpha
console.log(foo["2"]); // two
</pre>
<h3 id="String_literals" style="font-size: 1.142em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">String literals</h3>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">A string literal is zero or more characters enclosed in double (<code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">"</code>) or single (<code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">'</code>) quotation marks. A string must be delimited by quotation marks of the same type; that is, either both single quotation marks or both double quotation marks. The following are examples of string literals:</p>
<ul style="margin: 0px 0px 1.286em; padding: 0px 0px 0px 22px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
  <li><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">"foo"</code></li>
  <li><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">'bar'</code></li>
  <li><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">"1234"</code></li>
  <li><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">"one line \n another line"</code></li>
  <li><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">"John's cat"</code></li>
</ul>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">You can call any of the methods of the String object on a string literal value—JavaScript automatically converts the string literal to a temporary String object, calls the method, then discards the temporary String object. You can also use the<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">String.length</code><span class="Apple-converted-space">&nbsp;</span>property with a string literal:</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
"John's cat".length
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">You should use string literals unless you specifically need to use a String object. See<span class="Apple-converted-space">&nbsp;</span><a href="/en-US/docs/JavaScript/Guide/Predefined_Core_Objects#String_Object" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/JavaScript/Guide/Predefined Core Objects#String Object">String Object</a><span class="Apple-converted-space">&nbsp;</span>for details on<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">String</code><span class="Apple-converted-space">&nbsp;</span>objects.</p>
<h4 id="Using_special_characters_in_strings" style="font-size: 14px; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Using special characters in strings</h4>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">In addition to ordinary characters, you can also include special characters in strings, as shown in the following example.</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
"one line \n another line"
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">The following table lists the special characters that you can use in JavaScript strings.</p>
<table class="standard-table" style="font-size: 14px; margin-bottom: 1.286em; border-collapse: collapse; border: 1px dotted rgb(211, 211, 211); color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
  <caption style="font-weight: bold; text-align: left; ">
    Table 2.1 JavaScript special characters</caption>
  <thead>
    <tr>
      <th scope="col" style="font-family: inherit; font-size: inherit; color: inherit; padding: 0px 5px; border: 1px dotted rgb(211, 211, 211); background-color: rgb(238, 238, 238); text-align: left; font-weight: bold; background-position: initial initial; background-repeat: initial initial; ">Character</th>
      <th scope="col" style="font-family: inherit; font-size: inherit; color: inherit; padding: 0px 5px; border: 1px dotted rgb(211, 211, 211); background-color: rgb(238, 238, 238); text-align: left; font-weight: bold; background-position: initial initial; background-repeat: initial initial; ">Meaning</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; "><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">\b</code></td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Backspace</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; "><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">\f</code></td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Form feed</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; "><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">\n</code></td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">New line</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; "><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">\r</code></td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Carriage return</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; "><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">\t</code></td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Tab</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; "><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">\v</code></td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Vertical tab</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; "><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">\'</code></td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Apostrophe or single quote</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; "><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">\"</code></td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Double quote</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; "><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">\\</code></td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Backslash character (\).</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; "><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">\<em>XXX</em></code></td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">The character with the Latin-1 encoding specified by up to three octal digits<span class="Apple-converted-space">&nbsp;</span><em>XXX</em><span class="Apple-converted-space">&nbsp;</span>between 0 and 377. For example, \251 is the octal sequence for the copyright symbol.</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; "><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">\x<em>XX</em></code></td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">The character with the Latin-1 encoding specified by the two hexadecimal digits<span class="Apple-converted-space">&nbsp;</span><em>XX</em><span class="Apple-converted-space">&nbsp;</span>between 00 and FF. For example, \xA9 is the hexadecimal sequence for the copyright symbol.</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; "><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">\u<em>XXXX</em></code></td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">The Unicode character specified by the four hexadecimal digits<span class="Apple-converted-space">&nbsp;</span><em>XXXX</em>. For example, \u00A9 is the Unicode sequence for the copyright symbol. See {{anch("Unicode escape sequences")}}.</td>
    </tr>
  </tbody>
</table>
<h4 id="Escaping_characters" style="font-size: 14px; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Escaping characters</h4>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">For characters not listed in Table 2.1, a preceding backslash is ignored, but this usage is deprecated and should be avoided.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">You can insert a quotation mark inside a string by preceding it with a backslash. This is known as<span class="Apple-converted-space">&nbsp;</span><em>escaping</em><span class="Apple-converted-space">&nbsp;</span>the quotation mark. For example:</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var quote = "He read \"The Cremation of Sam McGee\" by R.W. Service.";
console.log(quote);
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">The result of this would be:</p>
<pre class="eval" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
He read "The Cremation of Sam McGee" by R.W. Service.
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">To include a literal backslash inside a string, you must escape the backslash character. For example, to assign the file path<span class="Apple-converted-space">&nbsp;</span><code style="font-style: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: inherit; font-weight: inherit; ">c:\temp</code><span class="Apple-converted-space">&nbsp;</span>to a string, use the following:</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var home = "c:\\temp";
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">You can also escape line breaks by preceding them with backslash. The backslash and line break are both removed from the value of the string.</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var str = "this string \
is broken \
across multiple\
lines."
<span class="objectBox objectBox-text ">console.log(str);</span>   // <span class="objectBox objectBox-text ">this string is broken across multiplelines.</span>
</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Although JavaScript does not have "heredoc" syntax, you can get close by adding a linebreak escape and an escaped linebreak at the end of each line:</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var poem = 
"Roses are red,\n\
Violets are blue.\n\
I'm schizophrenic,\n\
And so am I."
</pre>
<h2 id="Unicode" style="font-size: 1.428em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Unicode</h2>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Unicode is a universal character-coding standard for the interchange and display of principal written languages. It covers the languages of the Americas, Europe, Middle East, Africa, India, Asia, and Pacifica, as well as historic scripts and technical symbols. Unicode allows for the exchange, processing, and display of multilingual texts, as well as the use of common technical and mathematical symbols. It hopes to resolve internationalization problems of multilingual computing, such as different national character standards. Not all modern or archaic scripts, however, are currently supported.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">The Unicode character set can be used for all known encoding. Unicode is modeled after the ASCII (American Standard Code for Information Interchange) character set. It uses a numerical value and name for each character. The character encoding specifies the identity of the character and its numeric value (code position), as well as the representation of this value in bits. The 16-bit numeric value (code value) is defined by a hexadecimal number and a prefix U, for example, U+0041 represents A. The unique name for this value is LATIN CAPITAL LETTER A.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><strong>Unicode is not supported in versions of JavaScript prior to 1.3.</strong></p>
<h3 id="Unicode_compatibility_with_ASCII_and_ISO" style="font-size: 1.142em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Unicode compatibility with ASCII and ISO</h3>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Unicode is fully compatible with the International Standard ISO/IEC 10646-1; 1993, which is a subset of ISO 10646.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Several encoding standards (including UTF-8, UTF-16 and ISO UCS-2) are used to physically represent Unicode as actual bits.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">The UTF-8 encoding of Unicode is compatible with ASCII characters and is supported by many programs. The first 128 Unicode characters correspond to the ASCII characters and have the same byte value. The Unicode characters U+0020 through U+007E are equivalent to the ASCII characters 0x20 through 0x7E. Unlike ASCII, which supports the Latin alphabet and uses a 7-bit character set, UTF-8 uses between one and four octets for each character ("octet" meaning a byte, or 8 bits.) This allows for several million characters. An alternative encoding standard, UTF-16, uses two octets to represent Unicode characters. An escape sequence allows UTF-16 to represent the whole Unicode range by using four octets. The ISO UCS-2 (Universal Character Set) uses two octets.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">JavaScript and Navigator support for UTF-8/Unicode means you can use non-Latin, international, and localized characters, plus special technical symbols in JavaScript programs. Unicode provides a standard way to encode multilingual text. Since the UTF-8 encoding of Unicode is compatible with ASCII, programs can use ASCII characters. You can use non-ASCII Unicode characters in the comments, string literals, identifiers, and regular expressions of JavaScript.</p>
<h3 id="Unicode_escape_sequences" style="font-size: 1.142em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Unicode escape sequences</h3>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">You can use the Unicode escape sequence in string literals, regular expressions, and identifiers. The escape sequence consists of six ASCII characters: \u and a four-digit hexadecimal number. For example, \u00A9 represents the copyright symbol. Every Unicode escape sequence in JavaScript is interpreted as one character.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">The following code returns the copyright symbol and the string "Netscape Communications".</p>
<pre class="brush: js" style="margin: 0px 0px 1.286em; padding: 10px 20px; border: 1px solid rgb(213, 205, 187); overflow: auto; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
var x = "\u00A9 Netscape Communications";</pre>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">The following table lists frequently used special characters and their Unicode value.</p>
<table class="standard-table" style="font-size: 14px; margin-bottom: 1.286em; border-collapse: collapse; border: 1px dotted rgb(211, 211, 211); color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
  <caption style="font-weight: bold; text-align: left; ">
    Table 2.2 Unicode values for special characters</caption>
  <thead>
    <tr>
      <th scope="col" style="font-family: inherit; font-size: inherit; color: inherit; padding: 0px 5px; border: 1px dotted rgb(211, 211, 211); background-color: rgb(238, 238, 238); text-align: left; font-weight: bold; background-position: initial initial; background-repeat: initial initial; ">Category</th>
      <th scope="col" style="font-family: inherit; font-size: inherit; color: inherit; padding: 0px 5px; border: 1px dotted rgb(211, 211, 211); background-color: rgb(238, 238, 238); text-align: left; font-weight: bold; background-position: initial initial; background-repeat: initial initial; ">Unicode value</th>
      <th scope="col" style="font-family: inherit; font-size: inherit; color: inherit; padding: 0px 5px; border: 1px dotted rgb(211, 211, 211); background-color: rgb(238, 238, 238); text-align: left; font-weight: bold; background-position: initial initial; background-repeat: initial initial; ">Name</th>
      <th scope="col" style="font-family: inherit; font-size: inherit; color: inherit; padding: 0px 5px; border: 1px dotted rgb(211, 211, 211); background-color: rgb(238, 238, 238); text-align: left; font-weight: bold; background-position: initial initial; background-repeat: initial initial; ">Format name</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td rowspan="4" style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">White space values</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">\u0009</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Tab</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">&lt;TAB&gt;</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">\u000B</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Vertical Tab</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">&lt;VT&gt;</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">\u000C</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Form Feed</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">&lt;FF&gt;</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">\u0020</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Space</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">&lt;SP&gt;</td>
    </tr>
    <tr>
      <td rowspan="2" style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Line terminator values</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">\u000A</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Line Feed</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">&lt;LF&gt;</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">\u000D</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Carriage Return</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">&lt;CR&gt;</td>
    </tr>
    <tr>
      <td rowspan="5" style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Additional Unicode escape sequence values</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">\u0008</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Backspace</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">&lt;BS&gt;</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">\u0009</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Horizontal Tab</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">&lt;HT&gt;</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">\u0022</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Double Quote</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">"</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">\u0027</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Single Quote</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">'</td>
    </tr>
    <tr>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">\u005C</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">Backslash</td>
      <td style="font-family: inherit; font-size: inherit; color: inherit; padding: 5px; border: 1px dotted rgb(211, 211, 211); text-align: left; vertical-align: top; ">\</td>
    </tr>
  </tbody>
</table>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">The JavaScript use of the Unicode escape sequence is different from Java. In JavaScript, the escape sequence is never interpreted as a special character first. For example, a line terminator escape sequence inside a string does not terminate the string before it is interpreted by the function. JavaScript ignores any escape sequence if it is used in comments. In Java, if an escape sequence is used in a single comment line, it is interpreted as an Unicode character. For a string literal, the Java compiler interprets the escape sequences first. For example, if a line terminator escape character (e.g., \u000A) is used in Java, it terminates the string literal. In Java, this leads to an error, because line terminators are not allowed in string literals. You must use \n for a line feed in a string literal. In JavaScript, the escape sequence works the same way as \n.</p>
<h3 id="Unicode_characters_in_JavaScript_files" style="font-size: 1.142em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Unicode characters in JavaScript files</h3>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Earlier versions of<span class="Apple-converted-space">&nbsp;</span><a href="/en-US/docs/Gecko" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/Gecko">Gecko</a><span class="Apple-converted-space">&nbsp;</span>assumed the Latin-1 character encoding for JavaScript files loaded from XUL. Starting with Gecko 1.8, the character encoding is inferred from the XUL file's encoding. Please see<span class="Apple-converted-space">&nbsp;</span><a href="/en-US/docs/International_characters_in_XUL_JavaScript" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="en-US/docs/International_characters_in_XUL_JavaScript">International characters in XUL JavaScript</a><span class="Apple-converted-space">&nbsp;</span>for more information.</p>
<h3 id="Displaying_characters_with_Unicode" style="font-size: 1.142em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Displaying characters with Unicode</h3>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">You can use Unicode to display the characters in different languages or technical symbols. For characters to be displayed properly, a client such as Mozilla Firefox or Netscape needs to support Unicode. Moreover, an appropriate Unicode font must be available to the client, and the client platform must support Unicode. Often, Unicode fonts do not display all the Unicode characters. Some platforms, such as Windows 95, provide partial support for Unicode.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">To receive non-ASCII character input, the client needs to send the input as Unicode. Using a standard enhanced keyboard, the client cannot easily input the additional characters supported by Unicode. Sometimes, the only way to input Unicode characters is by using Unicode escape sequences.</p>
<p style="margin: 0px 0px 1.286em; padding: 0px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">For more information on Unicode, see the<span class="Apple-converted-space">&nbsp;</span><a class="external" href="http://www.unicode.org/" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; ">Unicode Home Page</a><span class="Apple-converted-space">&nbsp;</span>and The Unicode Standard, Version 2.0, published by Addison-Wesley, 1996.</p>
<h2 id="Resources" style="font-size: 1.428em; margin: 0px 0px 0.8em; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Resources</h2>
<ul style="margin: 0px 0px 1.286em; padding: 0px 0px 0px 22px; color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
  <li><a class="external" href="http://0xcc.net/jsescape/" style="text-decoration: none; cursor: default; color: rgb(51, 102, 153) !important; " title="Text Escaping and Unescaping in JavaScript">Text Escaping and Unescaping in JavaScript</a><span class="Apple-converted-space">&nbsp;</span>– an utility to convert characters in JavaScript unicode values</li>
</ul>
<div style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
  {{autoPreviousNext("JSGChapters")}}</div>
Reverter para esta revisão