var Summary Declares a variable with the external type. The variable can optionally be initialized to a value. Syntax var name1[= value1 [, name2 [, name3 ... [, nameN]]]]; Parameters nameN The name for the variable. This can be any valid identifier. valueN Optional. Initializes the variable to a value. This can be any valid expression. Description The var keyword declares variable(s) with the external type. The scope of the variable is the nearest block; if no block is present, the variable will be scoped to the file's top-level scope. For more information on variable declarations, consult the documentation for variable declarations. Examples Declaring an external variable 1var foo; Declaring multiple external variables in one statement 1var foo, bar, baz; Declaring and initializing an external variable 1var foo = 1; Declaring and initializing multiple external variables in one statement 1var foo = 1, bar = 2, baz = "3"; Importing jQuery and memoizing a selector 12345678// jQuery declares two symbols: 'jQuery' and '$' so we import both by conventionexternal jQuery, $; // Use "var" and memoize the jQuery selector like you would in JavaScriptvar $myElement = $("#myElement"); // Auto-magically works with JS++ typesstring text = $myElement.text(); See Also Variable Declarations external external type Compatibility with JavaScript Scopes Share HTML | BBCode | Direct Link