Skip to content

Commit 98732c6

Browse files
author
Ayush7Ranjan
committed
learn variable, how to use it, rules
1 parent ada15f4 commit 98732c6

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

02_variable/index.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
console.log("variable")
2+
3+
let a=67 //a container holds 67 . here a is identifier , = is assingment operator and 67 is literal(a contant value it can be string, num etc.)//
4+
5+
6+
console.log(a)
7+
8+
// in Java Script you can change the data type at run time just like a=num then a= string//
9+
10+
a="ayush"
11+
console.log(a)
12+
13+
// rules for variable name
14+
// letters, digit, underscore, $ sign allowed.
15+
//must begin with a $, _ and Letter
16+
// it is case sensitive
17+
//JavaScript reserved word cannot be used as a variable name
18+
19+
let ayush=7
20+
// let 9ayush=3 it can't allow
21+
let $ayush=2
22+
let Ayush=7
23+
// let var=3 not allowed because var is reserved word
24+
25+
console.log(ayush,$ayush, Ayush) // if you run this code you wil see "Ayush" not equal to "ayush"

0 commit comments

Comments
 (0)