Variables in JavaScript

Just like any other programing languages variables are used to store different type datas. The type of data may different, it may string, Number, Float ..etc.

In javascript variables are declared by using the keyword var

Variable Example

Anatomy of Program

JavaScript Protected Words

We can use any string as variables , But some words are protected as keywords. We can't use these keywords as variables . Some keywords are.

booleanbreak break byte
char class debugger
delete double import

JavaScript Constants

we use the keyword ' const ' to define constants in javascript

Javascript Contants

JavaScript Scope Of Variable

Javascript variables have two scope, Local and Global .

Local JavaScript Variable

A local variable is available only within a function or at the place of definition.

Global Variable

Global variables has global scope, that is, we wan define and use that variable anywhere in our JavaScript code