One Statement, Many Variables

You can declare many variables in one statement. Start the statement with var and separate the variables by comma:

  var person = "John Doe", carName = "Volvo", price = 200;

Such a declaration can be written on one line or span multiple lines:

  var person = "John Doe",
  carName = "Volvo",
  price = 200;

Back Table of Contents Next