O'Reilly logo

Definitive VoiceXML™ by David Cuddihy, Adam Hocek

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A.2. Variables

Variables in ECMAScript are declared using the var keyword. Variable names must begin with a letter or an underscore followed by zero or more letters, numbers, and underscores. ECMAScript variables are case-sensitive.

ECMAScript supports weak typing. The programmer does not need to specify the type of a variable when declaring it; the interpreter automatically associates one of the five built-in ECMAScript types with the new variable based on the nature of the value assigned to it. These built-in types are shown in Table A-2.

Table A-2. ECMAScript built-in types
TypeDescriptionExamples
numbereither a floating-point or integer
var e = 2.71828;
var i = -1;
Booleanonly true or false
var b = true;
stringa string of characters
 var ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required