variable as javascript code example
Example 1: js variable
var Number = 5;
var String = "Hi!";
var boolen1 = true;
var boolen2 = false;
var array = [11, "Hi!", true];
var object = {age:11, speach:"Hi!", likes_Bananas:true};
Example 2: javascript declare a variable
//choose the best for your solution
var myVariable = 22; //this can be a string or number. var is globally defined
let myVariable = 22; //this can be a string or number. let is block scoped
const myVariable = 22; //this can be a string or number. const is block scoped and can't be reassigned
Example 3: variable in js
////We can define variables in 3 ways {var,let,const}///////
////syntax- var variable_name=value;
///// let variable_name=value;
/////const variable_name=value;
var myfristvariable="neha jaiswal";
const mysecondvariable=80;
let mythirdvar=abc;