Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

var

The var statement is used to declare(and optionally initialize values for) one or more variables in a script.

Syntaxvar name, name, name;
var str = "Hi"; var num = 5;OR var str = "Hi", num = 5; Values are optional when declaring variables. Values can be assigned to them later in the script. var str, num; click here to learn more about variables

JavaScript

Statements

breakconstcontinuedo whileforfor inif elselabelreturnswitchtry catchvarwhilewith