Day 2 of #100daysofjs

Day 2 of #100daysofjs

Variables in JavaScript

What is Syntex in JavaScript?

Just like we follow some rules while speaking English (the grammar). We have some rules to follow while writing JavaScript programs. The set of these rules is called Syntex in Javascript.

What is a variable?

A variable is a container that stores a value. This is very similar to the container used to store rice, water and oats (Treat this as an analogy!)

The value of JavaSript variables can be changed during the execution of a program

var a = 7;

let a = 7;

Both are literal and a declaring variable

a= Identifier, (=) = assignment operators

Rules of choosing variable names

Letter, digits, underscore (_) and $ signed.

Must begin with a $, _ or a letter.

JavaScript reserved words cannot be used as a variable name

Harry & haRRy are different variables (CASE SENSITIVE).