how to write variables in javascript code example

Example 1: variables in js

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

Example 2: varianle in javascript

var one = 1; // variable stores numeric value

var two = 'two';  // variable stores string value

var three;  // declared a variable without assigning a value

Example 3: js variables

// let & var are both editable variables:
var cow = 'moo';
let pig = 'oink';
cow = 10;
pig = 10;
// const is a permanent variable; you cannot change it.
const uncuttableGrass = '\/\/';
uncuttableGrass = '___';
// above throws an error

Example 4: javascript variables

// Also let, const
var e_number = 0;
var e_string = '';
var e_true = true;
var e_false = false;
var e_undefined = undefined;

Tags:

Html Example