DEV Community

Mahin Tazuar
Mahin Tazuar

Posted on • Updated on

Javascript Variable

The first step in learning a programming language you need to understand variable declaration. Those are simple things, do not be hesitant.

In every Programming language, you need to define a value under a unique name with some syntax and rules, that syntax and rules are dependent on the specific programming language. Today we are discussed variable declaring in javascript language.

var  value1 = 'code';
const value2 = 'Coding';
let value3 = 'codding';
Enter fullscreen mode Exit fullscreen mode

please check the example, javascript have some reserved keyword for using declare a variable like var, const, let. After using any javascript reserved variable keyword we need to define a unique name with some special rules. In here used a specific name as a memorey reference. The value store into the memory under this uniqe name. When we are call this memory reference its return the value which is stored in memory.

  1. ( !, @, #, %, ^, &, *, (, ) ) we can not using this character as a first character in this unique name.
  2. we can not use any reserved keyword like function, name, let var as a unique name.
  3. Camael case and lowercase are two different values in javascript.
Note : Memory means. Javascript working in browser and its stored all data and exicute the data inside their own engine.Javascript use the browser memory when he needed.
Enter fullscreen mode Exit fullscreen mode

have more rules for define javascript variable name declaration, your need to explore .

After declaring a unique name you need to use the assingment operator then you need to define the variable value with his data type.
Before 2015 only var using for declaring variable after 2015 const and let reserved keyword coming and solved hoisting, scop related issue.

const and let have a specific use case and that is using as a standard coding. the const variable can not be changed fully but we can modify this value. And when we are using a let variable we can change the value as we wish.

Top comments (0)