how to define variable in javascript

JavaScript
//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 andvar <variable-name>;

var <variable-name> = <value>;
// write what ever you want
// one way is
// this is to declare intigers
var a = 10;
//this is to declare strings aka words
var b = "hi";
// the key word var can be replaced by let
//like this
let a = 10;
let b = "hi";
// i recomend using let insted of var
Source

Also in JavaScript: