Declare multiple variables in single line JavaScript

The most common way to declare a javascript variable is by writing each variable in a new line, for example.

 let name = "StudyFame";
var mystring = "Hello World";
let age=19; 

You can view the above variable are declared in the new line, but you can write the above-declared variable in a single line. for example,

 let name = "StudyFame", mystring = "Hello World", age=21;
  document.write(name)
  document.write(mystring)
  document.write(age)

The declaration above is in one line, we have declared are variable using the same keyword let.

Declare multiple variables in single line using destructuring assignment

 let [name, age, country] = ["StudyFame", 21, "United State"];
 document.write(name)
 document.write(age)
 document.write(country)

Even you can declare a variable by using the let or var keyword one time and declaring multiple variables in a new inline

 let name = "gaurav",
mystring = "Hello there",
age=21;
 document.write(name)
 document.write(mystring)
 document.write(age)

You can choose any keyword var, const, or let while declaring variable