Skip to content

Commit 49d1cd4

Browse files
authored
Add files via upload
1 parent 42f03de commit 49d1cd4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1342
-1406
lines changed

001-Hello.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/**
22
* Author : Jaydatt Patel
33
*/
4-
console.log('Hello World');
4+
console.log("Hello World");

002-Variables-and-Scope.js

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -38,111 +38,111 @@ const :
3838
3939
*/
4040

41-
4241
//var variables
4342
console.log("----------var variables---------");
4443

4544
var vx = 10;
4645
var vy = 20;
4746
{
48-
console.log('Inner-1 {} :',vx,vy);
47+
console.log("Inner-1 {} :", vx, vy);
4948
}
5049

5150
{
52-
var vx = 11;//this variable is same in outer and inner
53-
var vz = 30;
54-
console.log('Inner-2 {} :',vx,vy);
51+
var vx = 11; //this variable is same in outer and inner
52+
var vz = 30;
53+
console.log("Inner-2 {} :", vx, vy);
5554
}
5655

57-
console.log('Globle-after-{} :',vx,vy,vz);
58-
56+
console.log("Globle-after-{} :", vx, vy, vz);
5957

60-
function Vfoo1(){
61-
console.log('Vfoo1:',vx,vy,vz);
58+
function Vfoo1() {
59+
console.log("Vfoo1:", vx, vy, vz);
6260
}
6361
Vfoo1();
6462

65-
function Vfoo2(){
66-
//here function have same variables so it will assign as local variable.
67-
var vx = 1; //create local variable
68-
let vy = 2; //create local variable
69-
const vz = 3; //create local variable
70-
console.log('Vfoo2:',vx,vy,vz);
71-
63+
function Vfoo2() {
64+
//here function have same variables so it will assign as local variable.
65+
var vx = 1; //create local variable
66+
let vy = 2; //create local variable
67+
const vz = 3; //create local variable
68+
console.log("Vfoo2:", vx, vy, vz);
7269
}
7370
Vfoo2();
7471

75-
console.log('Globle-after-fun :',vx,vy,vz);
72+
console.log("Globle-after-fun :", vx, vy, vz);
7673

7774
//let letiables
7875
console.log("----------let variables---------");
7976

8077
let lx = 10;
8178
let ly = 20;
8279
{
83-
let lx = 11;// local variable with block.
84-
let lz = 30;// local variable with block.
85-
console.log('Inner {} :',lx,ly,lz);
80+
let lx = 11; // local variable with block.
81+
let lz = 30; // local variable with block.
82+
console.log("Inner {} :", lx, ly, lz);
8683
}
8784

88-
console.log("\nconsole.log('Globle-after-{} :',lx,ly,lz); //Error: lz is not defined means lz can not be access outside the block.\n")
85+
console.log(
86+
"\nconsole.log('Globle-after-{} :',lx,ly,lz); //Error: lz is not defined means lz can not be access outside the block.\n"
87+
);
8988
// console.log('Globle-after-{} :',lx,ly,lz); //Error: lz is not defined means lz can not be access outside the block.
9089

91-
console.log('Globle-after-{} :',lx,ly);
92-
90+
console.log("Globle-after-{} :", lx, ly);
9391

94-
function Lfoo1(){
95-
console.log('Lfoo1:',lx,ly);
92+
function Lfoo1() {
93+
console.log("Lfoo1:", lx, ly);
9694
}
9795
Lfoo1();
9896

99-
function Lfoo2(){
100-
//here function have same variables so it will assign as local variable.
101-
var lx = 1; //Local variable
102-
let ly = 2; //Local variable
103-
const lz =3; //Local variable
104-
console.log('Lfoo2:',lx,ly,lz);
105-
97+
function Lfoo2() {
98+
//here function have same variables so it will assign as local variable.
99+
var lx = 1; //Local variable
100+
let ly = 2; //Local variable
101+
const lz = 3; //Local variable
102+
console.log("Lfoo2:", lx, ly, lz);
106103
}
107104
Lfoo2();
108105

109-
console.log("\nconsole.log('Globle-after-fun :',lx,ly,lz); //Error: lz is not defined means lz can not be access outside the function.\n")
106+
console.log(
107+
"\nconsole.log('Globle-after-fun :',lx,ly,lz); //Error: lz is not defined means lz can not be access outside the function.\n"
108+
);
110109
// console.log('Globle-after-fun :',lx,ly,lz); //Error: lz is not defined means lz can not be access outside the function.
111-
console.log('Globle-after-fun :',lx,ly);
110+
console.log("Globle-after-fun :", lx, ly);
112111

113112
//const constiables
114113
console.log("----------const variables---------");
115114

116-
117115
let cx = 10;
118116
let cy = 20;
119117
{
120-
let cx = 11;// local variable with block.
121-
let cz = 30;// local variable with block.
122-
console.log('Inner {} :',cx,cy,cz);
118+
let cx = 11; // local variable with block.
119+
let cz = 30; // local variable with block.
120+
console.log("Inner {} :", cx, cy, cz);
123121
}
124122

125-
console.log("\nconsole.log('Globle-after-{} :',cx,cy,cz); //Error: cz is not defined means cz can not be access outside the block.\n")
123+
console.log(
124+
"\nconsole.log('Globle-after-{} :',cx,cy,cz); //Error: cz is not defined means cz can not be access outside the block.\n"
125+
);
126126
// console.log('Globle-after-{} :',cx,cy,cz); //Error: cz is not defined means cz can not be access outside the block.
127127

128-
console.log('Globle-after-{} :',cx,cy);
128+
console.log("Globle-after-{} :", cx, cy);
129129

130-
131-
function Cfoo1(){
132-
console.log('Cfoo1:',cx,cy);
130+
function Cfoo1() {
131+
console.log("Cfoo1:", cx, cy);
133132
}
134133
Cfoo1();
135134

136-
function Cfoo2(){
137-
//here function have same variables so it will assign as local variable.
138-
var cx = 1; //Local variable
139-
let cy = 2; //Local variable
140-
const cz =3; //Local variable
141-
console.log('Cfoo2:',cx,cy,cz);
142-
135+
function Cfoo2() {
136+
//here function have same variables so it will assign as local variable.
137+
var cx = 1; //Local variable
138+
let cy = 2; //Local variable
139+
const cz = 3; //Local variable
140+
console.log("Cfoo2:", cx, cy, cz);
143141
}
144142
Cfoo2();
145143

146-
console.log("\nconsole.log('Globle-after-fun :',cx,cy,cz); //Error: cz is not defined means cz can not be access outside the function.\n")
144+
console.log(
145+
"\nconsole.log('Globle-after-fun :',cx,cy,cz); //Error: cz is not defined means cz can not be access outside the function.\n"
146+
);
147147
// console.log('Globle-after-fun :',cx,cy,cz); //Error: cz is not defined means cz can not be access outside the function.
148-
console.log('Globle-after-fun :',cx,cy);
148+
console.log("Globle-after-fun :", cx, cy);

003-Variable-Strict-mode.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ Author : Jaydatt Patel
55
This mode allow to use variable which are defined with var,let and const. If you use variable without declare then it will give error 'ReferenceError': variable is not defined
66
*/
77

8-
9-
//error 'ReferenceError': variable is not defined
8+
//error 'ReferenceError': variable is not defined
109
// 'use strict';
1110
// a = 10;
12-
// console.log(a);
13-
11+
// console.log(a);
1412

15-
//error 'ReferenceError': variable is not defined
13+
//error 'ReferenceError': variable is not defined
1614
// function foo(){
1715
// 'use strict';
1816
// a = 10;
1917
// console.log(a)
2018
// }
21-
// foo();
19+
// foo();

004-Typeof-and-DataTypes.js

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,64 +3,65 @@
33
Data types and Typeof function
44
*/
55

6-
var obj = typeof("Hello");
7-
console.log("\"Hello\" :", obj);
6+
var obj = typeof "Hello";
7+
console.log('"Hello" :', obj);
88

9-
var obj = typeof('Hello"s world');
10-
console.log("\'Hello\"s world\':", obj);
9+
var obj = typeof 'Hello"s world';
10+
console.log("'Hello\"s world':", obj);
1111

12-
var obj = typeof(`"Hello's world"`);
13-
console.log("`\"Hello's world\"` :", obj);
12+
var obj = typeof `"Hello's world"`;
13+
console.log('`"Hello\'s world"` :', obj);
1414

15-
obj = typeof(10);
15+
obj = typeof 10;
1616
console.log("10 :", obj);
1717

18-
obj = typeof(10n);
18+
obj = typeof 10n;
1919
console.log("10n:", obj);
2020

21-
obj = typeof(3.14);
21+
obj = typeof 3.14;
2222
console.log("3.14 :", obj);
2323

24-
obj = typeof(true);
25-
console.log("true :",obj);
24+
obj = typeof true;
25+
console.log("true :", obj);
2626

27-
obj = typeof(1<=2);
28-
console.log("(1<=2) :",obj);
27+
obj = typeof (1 <= 2);
28+
console.log("(1<=2) :", obj);
2929

30-
obj = typeof([1,2,3]);
31-
console.log("[1,2,3] :",obj);
30+
obj = typeof [1, 2, 3];
31+
console.log("[1,2,3] :", obj);
3232

33-
obj = typeof({ city : 'Ahme'});
34-
console.log("{ city : 'Ahme'} :",obj);
33+
obj = typeof { city: "Ahme" };
34+
console.log("{ city : 'Ahme'} :", obj);
3535

36-
var obj = typeof(null);
36+
var obj = typeof null;
3737
console.log("NULL:", obj);
3838

39-
var obj = typeof(var_undefine);
39+
var obj = typeof var_undefine;
4040
console.log("var_undefine :", obj);
4141

42-
obj = typeof(function sum(a,b) {return(a+b)});
43-
console.log("function sum(a,b) {return(a+b)} :",obj);
42+
obj = typeof function sum(a, b) {
43+
return a + b;
44+
};
45+
console.log("function sum(a,b) {return(a+b)} :", obj);
4446

47+
obj = typeof new Date(); //=== "object";
48+
console.log("(new Date()) :", obj);
4549

46-
obj = typeof (new Date()) //=== "object";
47-
console.log("(new Date()) :",obj);
48-
49-
obj = typeof /regex/ //=== "object";
50-
console.log("/regex/ :",obj);
50+
obj = typeof /regex/; //=== "object";
51+
console.log("/regex/ :", obj);
5152

5253
// The following are confusing, dangerous, and wasteful. Avoid them.
53-
obj = typeof (new Boolean(true)) //=== "object";
54-
console.log("(new Boolean(true)) :",obj);
55-
obj = typeof (new Number(1)) //=== "object";
56-
console.log("(new Number(1)) :",obj);
57-
obj = typeof (new String("abc")) //=== "object";
58-
console.log("(new String(\"abc\"):",obj);
54+
obj = typeof new Boolean(true); //=== "object";
55+
console.log("(new Boolean(true)) :", obj);
56+
obj = typeof new Number(1); //=== "object";
57+
console.log("(new Number(1)) :", obj);
58+
obj = typeof new String("abc"); //=== "object";
59+
console.log('(new String("abc"):', obj);
5960

6061
// Functions
61-
obj = typeof function () {} //=== "function";
62-
console.log("function () {} :",obj);
63-
obj = typeof class C {} //=== "function";
64-
console.log("class C {} :",obj);
65-
obj = typeof Math.sin //=== "function";
66-
console.log("Math.sin :",obj);
62+
obj = typeof function () {}; //=== "function";
63+
console.log("function () {} :", obj);
64+
obj = typeof class C {}; //=== "function";
65+
console.log("class C {} :", obj);
66+
obj = typeof Math.sin; //=== "function";
67+
console.log("Math.sin :", obj);

0 commit comments

Comments
 (0)