Var Keyword

ยท

1 min read

Var Keyword

The var keyword in JavaScript is used to declare variables. It was introduced before ES2015. But with ES6 (ES2015), let and const were introduced to offer more controlled variable declaration.

๐Ÿ˜ Now here is a point to notice, why was the 'let' keyword introduced in ES2015 to declare variables when 'var' already existed for this purpose?

Just think about it do some research on your own, and if you do not get the answers that I will discuss this topic in the upcoming lessons.

Let's continue the discussion ๐Ÿ‘‰

Variable Declaration using var and let keyword.

var name;
let age;

Here, name and age are the variables and var and let are the keywords ,used to declare the variable (name and age).

We will discuss variables, rules for naming variables in JavaScript, and other important concepts in our next lesson.

So, this is a brief introduction to the 'var' keyword. We'll delve deeper into 'var', 'let', and 'const' in our upcoming lessons after we cover more about variables. Please be patient and take time to think about the question I previously asked ๐Ÿ™„

ย