create var in js code example

Example 1: variables in js

var Hello = "World";
let bool = false;
const int = 8788;

Example 2: how to define variable in javascript

var <variable-name>;

var <variable-name> = <value>;

Example 3: js var

var nomevariabile1 [= valore1] [, nomevariabile2 [= valore2] ... [, nomevariabileN [= valoreN]]];

Example 4: how to create variables using javascript

var myVar;       //unitialized variable( can be intiallized later )
var number = 1; //number
var string = " hello world " ; //string
var boolean = true ;  //boolean
myVar = function(){  //variable can hold function
  
};

Tags:

Html Example