File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ console . log ( "Nilaj" ) ;
2+ console . log ( "Chakraborty" ) ;
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > Document</ title >
7+ </ head >
8+ < body >
9+ </ body >
10+ < script src ="first.js "> </ script >
11+ </ html >
Original file line number Diff line number Diff line change 1+
2+ //Dynamically typed language need not to mention data type of the variable
3+
4+ /*
5+ Variable rules
6+ 1.Case sensitive
7+ 2.Letter digit underscore and $ allowed should be 1st Charecter
8+ 3.reseverd words can not be variables.
9+ */
10+
11+ /*
12+
13+ Data type in Js
14+
15+ Number String Boolean Null undefined Symbol Bigint
16+ */
17+
18+
19+ //string
20+ m = "tony" ;
21+ console . log ( m ) ;
22+ //int
23+ a = 10 ;
24+ console . log ( a ) ;
25+
26+ //float
27+ b = 10.25 ;
28+ console . log ( b ) ;
29+ //null
30+ x = null ;
31+ console . log ( x ) ;
32+ //undefined
33+ y = undefined ;
34+ console . log ( y ) ;
35+
36+ //boolean
37+ isfollow = false ;
38+ is = true ;
39+ console . log ( isfollow ) ;
40+ console . log ( is ) ;
41+
42+ $full = 5 ;
43+ console . log ( $full ) ;
44+
45+ z = BigInt ( "9" ) ;
46+ console . log ( z ) ;
47+
48+ let p = Symbol ( "hello" ) ;
49+ console . log ( p ) ;
50+
51+
52+ /*
53+ let var & const
54+ -----------------
55+ var: variable can be redeclared & updated. A global scope variable before 2015 we used var
56+
57+
58+ but in 2015 in javascript has new features called ES6 and we use the following keyword
59+
60+ let:variable can not be re-declared but can be updated. block scope variable.
61+
62+ const: variable can not be re-declared or updated.A block scope variable.
63+
64+ */
65+
66+ //var
67+
68+ var age = 25 ;
69+ var age = 45 ;
70+ console . log ( age ) //45
71+
72+
73+ //let
74+ let n = 76 ;
75+ n = 90 ;
76+ n = 86 ;
77+ console . log ( n ) ; //86
78+ //block scope
79+ {
80+ let o = 89 ;
81+ console . log ( o ) ;
82+ }
83+
84+ {
85+ let o = 54 ;
86+ console . log ( o ) ;
87+
88+ }
89+
90+
91+ //const
92+
93+ const t = 10 ;
94+ console . log ( t ) ;
95+
96+ /*
97+ Object collection of different variables
98+ */
99+ const student = {
100+ fullname :"Nilaj Chakraborty" ,
101+ age :26 ,
102+ cgpa :9.34 ,
103+ ispass :true ,
104+
105+ } ;
106+ console . log ( student . age ) ;
107+
108+
109+ const product = {
110+ title :"Ball pen" ,
111+ rating :5 ,
112+ offer :25 ,
113+ price :1200
114+ } ;
115+ console . log ( product ) ;
116+
117+
118+
119+ const profile = {
120+ username :"@nilaj" ,
121+ isfollowes :true ,
122+ followers : 100 ,
123+ following :120 ,
124+ } ;
125+
126+ console . log ( profile ) ;
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > Document</ title >
7+ </ head >
8+ < body >
9+
10+ </ body >
11+ < script src ="examples.js "> </ script >
12+ </ html >
You can’t perform that action at this time.
0 commit comments