Skip to content

Commit 78239ac

Browse files
committed
init
0 parents  commit 78239ac

File tree

40 files changed

+662
-0
lines changed

40 files changed

+662
-0
lines changed
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>10 - Events and Event Listeners</title>
5+
</head>
6+
<body>
7+
<button onclick="display();">CLICK ME!</button>
8+
<script src="main.js"></script>
9+
</body>
10+
</html>
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function display() {
2+
console.log("You clicked the Button!");
3+
}

11 - Window Hoisting/index.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>11 - Window Hoisting</title>
5+
</head>
6+
<body>
7+
<script src="main.js"></script>
8+
</body>
9+
</html>

11 - Window Hoisting/main.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
console.log(a);
2+
console.log(b);
3+
4+
var a = 10;
5+
let b = 20;

12 - Closure/index.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>12 - Closure</title>
5+
</head>
6+
<body>
7+
<script src="main.js"></script>
8+
</body>
9+
</html>

12 - Closure/main.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
let fn = () => {
2+
let i = 1;
3+
return () => {
4+
console.log(i);
5+
};
6+
};
7+
8+
console.dir(fn());

13 - Scopes/index.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>13 - Scopes</title>
5+
</head>
6+
<body>
7+
<script src="main.js"></script>
8+
</body>
9+
</html>

13 - Scopes/main.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const s = 30;
2+
3+
function display(params) {
4+
var a = 10;
5+
console.log(a);
6+
console.log(c);
7+
}
8+
9+
{
10+
let b = 20;
11+
console.log(b);
12+
console.log(c);
13+
}
14+
15+
console.log(a);
16+
console.log(b);
17+
console.log(c);

14 - Arrow Function/index.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>14 - Arrow Function</title>
5+
</head>
6+
<body>
7+
<script src="main.js"></script>
8+
</body>
9+
</html>

14 - Arrow Function/main.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
function Display() {
2+
this.speed = 0;
3+
var self = this;
4+
setInterval(function () {
5+
self.speed++;
6+
console.log(self.speed);
7+
}, 300);
8+
}
9+
10+
var d1 = new Display();
11+
12+
//========================
13+
14+
function Display() {
15+
this.speed = 0;
16+
setInterval(() => {
17+
this.speed++;
18+
console.log(this.speed);
19+
}, 1000);
20+
}
21+
22+
var d1 = new Display();

15 - Array Methods/index.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>15 - Array Methods</title>
5+
</head>
6+
<body>
7+
<script src="main.js"></script>
8+
</body>
9+
</html>

15 - Array Methods/main.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const arr = [1, 2, 3];
2+
console.log(arr.length);
3+
4+
arr.forEach((item) => console.log(item));
5+
6+
const modifiedArr = arr.map((item) => item * 2);
7+
const filteredArr = arr.filter((item) => item < 2);
8+
9+
const slicedArr = arr.slice(1, 2);
10+
11+
const indexOfArr = arr.indexOf(2);
12+
13+
const pushedArr = arr.push(4);
14+
const unshiftArr = arr.unshift(0);
15+
16+
const poppedArr = arr.pop();
17+
const shiftedArr = arr.shift();

16 - 'this' Keyword/index.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>16 - 'this' Keyword</title>
5+
</head>
6+
<body>
7+
<script src="main.js"></script>
8+
</body>
9+
</html>

16 - 'this' Keyword/main.js

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
const someoneDetails = {
2+
name: "Someone!",
3+
designation: "Instructor",
4+
displayName: () => console.log(this.name),
5+
};
6+
7+
someoneDetails.displayName(); // Implicit Binding
8+
9+
// =======================
10+
11+
const lang = ["HTML", "CSS", "JS"];
12+
13+
const someoneDetails = {
14+
name: "Someone!",
15+
};
16+
17+
function display(languages) {
18+
console.log(`${this.name} knows ${languages}`);
19+
}
20+
21+
display.call(someoneDetails, lang); // Explicit - call
22+
display.call(someoneDetails, lang[0], lang[1], lang[2]);
23+
24+
// =====================
25+
26+
const lang = ["HTML", "CSS", "JS"];
27+
28+
const someoneDetails = {
29+
name: "Someone!",
30+
};
31+
32+
function display(lan1, lan2, lan3) {
33+
console.log(`${this.name} knows ${lan1}, ${lan2} and ${lan3}`);
34+
}
35+
36+
display.apply(someoneDetails, lang); // Explicit - apply
37+
38+
// =====================
39+
40+
const lang = ["HTML", "CSS", "JS"];
41+
42+
const someoneDetails = {
43+
name: "Someone!",
44+
};
45+
46+
function display(languages) {
47+
console.log(`${this.name} knows ${languages}`);
48+
}
49+
50+
display.bind(someoneDetails, lang)(); // Explicit - bind
51+
52+
//=======================
53+
54+
const name = "Someone!";
55+
console.log(this.name); // Window binding
56+
57+
// ======================
58+
59+
function Student() {
60+
this.name = name;
61+
}
62+
63+
const s1 = new Student("Someone"); // New Binding

17 - Class and Inheritance/index.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>17 - Class and Inheritance</title>
5+
</head>
6+
<body>
7+
<script src="main.js"></script>
8+
</body>
9+
</html>

17 - Class and Inheritance/main.js

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
class Animal {
2+
constructor(name) {
3+
this.name = name;
4+
}
5+
6+
walk() {
7+
console.log(`${this.name} can Walk!`);
8+
}
9+
10+
eat() {
11+
console.log(`${this.name} can Walk!`);
12+
}
13+
14+
sleep() {
15+
console.log(`${this.name} can Walk!`);
16+
}
17+
}
18+
19+
class Human extends Animal {
20+
constructor(name) {
21+
super(name);
22+
this.age = age;
23+
}
24+
25+
think() {
26+
console.log(`${this.name} can Think!`);
27+
}
28+
}
29+
30+
class Bird extends Human {
31+
constructor(name) {
32+
super(name);
33+
}
34+
35+
fly() {
36+
console.log(`${this.name} can Fly!`);
37+
}
38+
}
39+
const a1 = new Animal("Lion");
40+
const h1 = new Human("Someone");
41+
const b1 = new Bird("Pigeon");
42+
43+
a1.eat();
44+
h1.eat();
45+
b1.eat();
46+
47+
h1.think();
48+
49+
b1.fly();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>18 - Object and Array Destructuring & Short Hands</title>
5+
</head>
6+
<body>
7+
<script src="main.js"></script>
8+
</body>
9+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const [name, age] = ["Someone", 20];
2+
3+
console.log(name);
4+
console.log(age);
5+
6+
const { name, age } = { name: "Someone", age: 20 };
7+
8+
console.log(name);
9+
console.log(age);
10+
11+
const { name, ...details } = {
12+
name: "Someone!",
13+
age: 20,
14+
location: "Somewhere",
15+
};
16+
17+
console.log(name);
18+
console.log(details);
19+
20+
function display({ name, location: city }) {
21+
console.log(`${name} lives in ${city}`);
22+
}
23+
24+
display({ name: "Someone", location: "Somewhere" });

19 - Callbacks/index.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>19 - Callbacks</title>
5+
</head>
6+
<body>
7+
<script src="main.js"></script>
8+
</body>
9+
</html>

19 - Callbacks/main.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function display(number) {
2+
console.log(`I'm displaying ${number}`);
3+
}
4+
5+
function main(fn) {
6+
fn(2);
7+
}
8+
9+
main(display);
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>20 - Promise and Async-Await</title>
5+
</head>
6+
<body>
7+
<script src="main.js"></script>
8+
</body>
9+
</html>

0 commit comments

Comments
 (0)