JavaScript-Variables

Photo by Andrew Neel on Unsplash

JavaScript-Variables

Variables in Javascript in a easy way-

Let's understand what really variables in JS-

Here are some definitions-

Variables are containers that hold reusable data. It is the basic unit of storage in the program. OR

A value stored in a variable can be changed during program execution. A variable is only a name given to a memory location, all the operations done on the the variable effects that memory location.

Note: Before 2015- Variables declared using var keyword followed by the name of the variable name and semicolon.

var number = 37;

Imp....

let full_Name = 'Anurag Tiwari';

The full_Name is the name of the variable which should be defined by the user and should be unique that match your task. These types of names are also known as identifiers.

In Javascript, the name of the identifiers should not be any pre-defined word, the first character must be a letter , an (_) or a ($) sign.

Storing a mathematical exp-

var x = 3 + 34 + 3;
console.log(x) ;