Skip to content

Commit 3ba9148

Browse files
authored
Merge pull request #15 from tapascript/day-12
(feat) Day 12 done
2 parents 6b9c7d3 + ef2e9d1 commit 3ba9148

File tree

9 files changed

+482
-2
lines changed

9 files changed

+482
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ I am an independent educator and open-source enthusiast who creates meaningful p
3333
- **`Day 08: Mastering JavaScript Execution Context Visually`** - [Watch Video](https://youtu.be/ylx5F7hbzVQ) || [Source Code](https://github.com/tapascript/40-days-of-javascript/blob/main/day-08/README.md)
3434
- **`Day 09: Mastering Temporal Dead Zone and Hoisting`** - [Watch Video](https://youtu.be/OqMxh1QdYEg) || [Source Code](https://github.com/tapascript/40-days-of-javascript/blob/main/day-09/README.md)
3535
- **`Day 10: Mastering Scope and Scope Chain`** - [Watch Video](https://youtu.be/14H2TsrjcLo) || [Source Code](https://github.com/tapascript/40-days-of-javascript/blob/main/day-10/README.md)
36-
- **`Day 11: Learn Closures With Real-World Examples`** - [Watch Video](https://youtu.be/lA7CGz3iHyI) || [Source Code](https://github.com/tapascript/40-days-of-javascript/blob/main/day-11/README.md)
36+
- **`Day 11: Learn Closures With Real-World Examples`** - [Watch Video](https://youtu.be/lA7CGz3iHyI) || [Source Code](https://github.com/tapascript/40-days-of-javascript/blob/main/day-11/README.md)
37+
- **`Day 12: Mastering JavaScript Objects Real-World Examples`** - [Watch Video](https://youtu.be/c5vEfYj5yZM) || [Source Code](https://github.com/tapascript/40-days-of-javascript/blob/main/day-12/README.md)

day-11/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- ✅ Closure & Event Handlers
1414

1515
## 🫶 Support
16+
1617
Your support means a lot.
1718

1819
- Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
@@ -21,14 +22,15 @@ Your support means a lot.
2122
> Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
2223
2324
### 🤝 Sponsor My Work
25+
2426
I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
2527

2628
## Video
29+
2730
Here is the video for you to go through and learn:
2831

2932
[![day-11](./banner.png)](https://youtu.be/lA7CGz3iHyI "Video")
3033

31-
3234
## **👩‍💻 🧑‍💻 Assignment Tasks**
3335

3436
Please find the task assignments in the [Task File](./task.md).

day-12/README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Day 12 - 40 Days of JavaScript
2+
3+
## **🎯 Goal of This Lesson**
4+
5+
- ✅ Welcome To Day 12
6+
- ✅ What Will We Cover?
7+
- ✅ JavaScript Objects
8+
- ✅ Create Objects with Literal Syntax
9+
- ✅ Accessing Object Properties
10+
- ✅ Adding New Property to Object
11+
- ✅ Keys With Special Characters
12+
- ✅ Modifying Existing Property Value
13+
- ✅ Deleting a Key From Object
14+
- ✅ Accessing Dynamic Key Value
15+
- ✅ Create Object With Dynamic Values
16+
- ✅ Constructor Function To Create Objects
17+
- ✅ Using Object Constructor
18+
- ✅ Using Factory Function
19+
- ✅ Object Shorthand
20+
- ✅ Object Methods
21+
- ✅ Nested Objects
22+
- ✅ The “in” operator
23+
- ✅ The for…in loop
24+
- ✅ Object.keys() method
25+
- ✅ Object References
26+
- ✅ B.R.E.A.K
27+
- ✅ Object.assign()
28+
- ✅ Shallow Copy vs. Deep Copy
29+
- ✅ Convert an Object to an Array
30+
- ✅ Concert Map or Array to Object
31+
- ✅ Immutability with freeze()
32+
- ✅ Immutability with seal()
33+
- ✅ The hasOwn() Method
34+
- ✅ What is Object Destructuring?
35+
- ✅ Create a New Variable
36+
- ✅ Aliases
37+
- ✅ Nested Object Destructuring
38+
- ✅ Destructuring to Function Parameter
39+
- ✅ Destructure a Function Return Value
40+
- ✅ Destructuring in Loops
41+
- ✅ Optional Chaining
42+
- ✅ Are You Tired?
43+
44+
## 🫶 Support
45+
46+
Your support means a lot.
47+
48+
- Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
49+
- Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
50+
51+
> Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
52+
53+
### 🤝 Sponsor My Work
54+
55+
I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
56+
57+
## Video
58+
59+
Here is the video for you to go through and learn:
60+
61+
[![day-12](./banner.png)](https://youtu.be/c5vEfYj5yZM "Video")
62+
63+
## **👩‍💻 🧑‍💻 Assignment Tasks**
64+
65+
Please find the task assignments in the [Task File](./task.md).

day-12/banner.png

908 KB
Loading

day-12/destructuring.js

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
console.log("Learn Object Destructuring....")
2+
3+
const student = {
4+
'name': 'John Williamson',
5+
'age': 9,
6+
'std': 3,
7+
'subjects': ['Maths', 'English', 'EVS'],
8+
'parents': {
9+
'father': 'Brown Williamson',
10+
'mother': 'Sophia',
11+
'email': 'john-parents@abcde.com'
12+
},
13+
'address': {
14+
'street': '65/2, brooklyn road',
15+
'city': 'Carterton',
16+
'country': 'New Zealand',
17+
'zip': 5791
18+
}
19+
}
20+
21+
const {name, age, meal="bread"} = student;
22+
console.log(name, age, meal);
23+
24+
const {subjects, numberOfSubjects = subjects.length} = student;
25+
console.log(numberOfSubjects); // 3
26+
27+
const {std: standard} = student;
28+
console.log(standard)
29+
30+
const {address: {zip}} = student;
31+
console.log(zip);
32+
33+
function sendEmail({parents: {email}}) {
34+
console.log(`Sent an email to ${email}`)
35+
}
36+
37+
sendEmail(student);
38+
39+
40+
41+
const getStudent = () => {
42+
return {
43+
'name': 'John Williamson',
44+
'age': 9,
45+
'std': 3,
46+
'subjects': ['Maths', 'English', 'EVS'],
47+
'parents': {
48+
'father': 'Brown Williamson',
49+
'mother': 'Sophia',
50+
'email': 'john-parents@abcde.com'
51+
},
52+
'address': {
53+
'street': '65/2, brooklyn road',
54+
'city': 'Carterton',
55+
'country': 'New Zealand',
56+
'zip': 5791
57+
}
58+
}
59+
}
60+
61+
const {name: anotherName, subjects: anotherSubs} = getStudent();
62+
console.log(anotherName, anotherSubs)
63+
64+
65+
const students = [
66+
{
67+
'name': 'William',
68+
'grade': 'A'
69+
},
70+
{
71+
'name': 'Tom',
72+
'grade': 'A+'
73+
},
74+
{
75+
'name': 'Bob',
76+
'grade': 'B'
77+
}
78+
];
79+
80+
for ( let {name, grade} of students) {
81+
console.log(name, grade)
82+
}
83+
84+
85+

day-12/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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>Objects</title>
7+
<script defer src="./oc.js"></script>
8+
</head>
9+
<body>
10+
<h1>Welcome to the <u>Day 12</u> of "40 Days of JavaScript!"</h1>
11+
</body>
12+
</html>

0 commit comments

Comments
 (0)