0% found this document useful (0 votes)
4 views19 pages

Understanding JavaScript Variables and Keywords

The document explains the concepts of variables, keywords, and identifiers in programming, emphasizing their roles in storing and managing data. It outlines the rules for naming identifiers, including case sensitivity and the use of meaningful names. Additionally, it lists reserved words in JavaScript that cannot be used as variable names.

Uploaded by

P.V. AADI VISHNU
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views19 pages

Understanding JavaScript Variables and Keywords

The document explains the concepts of variables, keywords, and identifiers in programming, emphasizing their roles in storing and managing data. It outlines the rules for naming identifiers, including case sensitivity and the use of meaningful names. Additionally, it lists reserved words in JavaScript that cannot be used as variable names.

Uploaded by

P.V. AADI VISHNU
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Variables, Keywords,

Identifiers
Variables

Storage boxes
Camel
x=5+2
Assignment operator

5+2 5-2
Left operand Right operand Left operand Right operand

Addition operator Subtraction operator


Karam Chinta
Amma cheti vanta
pandu Sugar

Masala Odiyalu

Salt Oil

var, const
air( gali ) let dabba dabba ?

=
dabba = 100
Salt
100
let dabba
Declaring a variable
How did we create a variable?
Brendan Eich

Keywords Identifiers
dabba let dabba
let dabba

dabba2
var dabba2 var dabba2
const dabba3

dabba3 const dabba3 function nextCheptale

class EdiKuda

if
Keywords are the reserved else Identifiers are names used to identify
words that has a pre-defined variables, functions, classes and other
switch
meaning entities in our code
Varamiyyu Deva

Ramu
Please subscribe to our channel Somu
There are some rules for naming identifiers

1 The name must contain only letters, digits or


the symbols $ and _
➢ Letters a-z, A-Z
➢ Digits 0-9
➢ Dollar sign $
➢ Underscore _
➢ They cannot include spaces or special characters

2 First character must not be a digit

3 The name can not be a JavaScript


keyword/reserved word
Varamiyyu Deva

Ramu
Please subscribe to our channel Somu
Identifiers are case sensitive
Good developers follow below rules

1 Use meaning full names that describe


the purpose of the variable

2 Use camelCase for variables and


functions, PascalCase for classes

There will not be any error as all of them are not same
suresh is a good boy lower case
SURESH IS A GOOD BOY upper case
camelCase
suresh is a good boy lower case
SURESH IS A GOOD BOY upper case

sureshIsAGoodBoy camel case


suresh_is_a_good_boy snake case
suresh-is-a-good-boy kebab case
SureshIsAGoodBoy pascal case
Identifiers are case sensitive
Good developers follow below rules

1 Use meaning full names that describe


the purpose of the variable

2 Use camelCase for variables and


functions, PascalCase for classes

3 Avoid using single character names


except for loop counters. Eg: i, j

There will not be any error as all of them are not same
Reserved words

3 The name can not be a JavaScript


keyword/reserved word

jingri
Registered
Brendan Eich

We are reserving this word, so please don’t


use it as a variable name
Reserved words
break else null with
case export return yield
catch extends static
false super
class finally switch
const for this
continue function throw
debugger if true
import try
default in type of
delete instance of var
do let void
new while
What is a variable?
• Variable is like a container/storage
box that holds a value

• Variables allows us to store,


retrieve and modify the data

• Variables can be declared using


var, let or const keywords
Chapter 14

let, var, const

You might also like