├── README.md
├── Week1
├── Assignment 5
│ ├── index.html
│ └── main.js
├── Assignment 6
│ ├── index.html
│ └── main.js
├── assignment 1
│ ├── index.html
│ └── main.js
├── assignment 2
│ ├── index.html
│ └── main.js
├── assignment 3
│ ├── index.html
│ └── main.js
└── assignment 4
│ ├── index.html
│ └── main.js
├── Week10
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
├── Assignment4
│ ├── index.html
│ └── main.js
├── Assignment5
│ ├── index.html
│ └── main.js
├── Assignment6
│ ├── index.html
│ └── main.js
└── Assignment7
│ ├── index.html
│ └── main.js
├── Week11
└── Assignment1
│ ├── index.html
│ └── main.js
├── Week12
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
├── Assignment4
│ ├── index.html
│ └── main.js
├── Assignment5
│ ├── index.html
│ └── main.js
└── Assignment6
│ ├── index.html
│ └── main.js
├── Week13
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
└── Assignment4
│ ├── index.html
│ └── main.js
├── Week14
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
├── Assignment4
│ ├── index.html
│ └── main.js
└── Assignment5
│ ├── index.html
│ └── main.js
├── Week15
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
└── Assignment4
│ ├── index.html
│ └── main.js
├── Week16
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
├── Assignment4
│ ├── index.html
│ └── main.js
├── Assignment5
│ ├── index.html
│ └── main.js
└── Assignment6
│ ├── index.html
│ └── main.js
├── Week17
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
├── Assignment4
│ ├── index.html
│ └── main.js
└── Assignment5
│ ├── index.html
│ └── main.js
├── Week18
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ ├── main.css
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
├── Assignment4
│ ├── index.html
│ └── main.js
└── Assignment5
│ ├── index.html
│ └── main.js
├── Week19
├── Assignment1
│ ├── index.html
│ ├── main.css
│ └── main.js
└── Assignment2
│ ├── index.html
│ ├── main.css
│ └── main.js
├── Week2
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
└── Assignment4
│ ├── index.html
│ └── main.js
├── Week20
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
├── Assignment4
│ ├── index.html
│ └── main.js
├── Assignment5
│ ├── index.html
│ └── main.js
└── Assignment6
│ ├── index.html
│ └── main.js
├── Week21
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
├── Assignment4
│ ├── index.html
│ └── main.js
├── Assignment5
│ ├── index.html
│ └── main.js
├── Assignment6
│ ├── index.html
│ └── main.js
├── Assignment7
│ ├── index.html
│ └── main.js
└── Assignment8
│ ├── index.html
│ └── main.js
├── Week22
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
├── Assignment4
│ ├── index.html
│ └── main.js
├── Assignment5
│ ├── index.html
│ └── main.js
└── Assignment6
│ ├── index.html
│ └── main.js
├── Week23
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
├── Assignment4
│ ├── index.html
│ └── main.js
└── Assignment5
│ ├── index.html
│ └── main.js
├── Week24
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
├── Assignment4
│ ├── index.html
│ └── main.js
├── Assignment5
│ ├── index.html
│ └── main.js
├── Assignment6
│ ├── index.html
│ └── main.js
├── Assignment7
│ ├── index.html
│ └── main.js
└── Assignment8
│ ├── index.html
│ ├── main.js
│ ├── mod-one.js
│ └── mod-two.js
├── Week25
├── Assignment1
│ ├── articles.json
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── articles.json
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── articles.json
│ ├── index.html
│ └── main.js
└── Assignment4
│ ├── articles.json
│ ├── index.html
│ └── main.js
├── Week26
├── Assignment1
│ ├── index.html
│ ├── jsonObject.json
│ └── main.js
└── Assignment2
│ ├── index.html
│ ├── jsonObject.json
│ └── main.js
├── Week3
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
└── Assignment3
│ ├── index.html
│ └── main.js
├── Week4
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
├── Assignment4
│ ├── index.html
│ └── main.js
├── Assignment5
│ ├── index.html
│ └── main.js
├── Assignment6
│ ├── index.html
│ └── main.js
└── Assignment7
│ ├── index.html
│ └── main.js
├── Week5
├── Assignment1
│ ├── index.html
│ └── main.js
└── Assignment2
│ ├── index.html
│ └── main.js
├── Week6
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
└── Assignment3
│ ├── index.html
│ └── main.js
├── Week7
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
└── Assignment4
│ ├── index.html
│ └── main.js
├── Week8
└── Assignment1
│ ├── index.html
│ └── main.js
├── Week9
├── Assignment1
│ ├── index.html
│ └── main.js
├── Assignment2
│ ├── index.html
│ └── main.js
├── Assignment3
│ ├── index.html
│ └── main.js
├── Assignment4
│ ├── index.html
│ └── main.js
├── Assignment5
│ ├── index.html
│ └── main.js
└── Assignment6
│ ├── index.html
│ └── main.js
├── app.js
├── desktop.ini
├── index.html
├── main.css
├── main.js
├── test.json
└── test.xml
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |

6 |
Js course
7 |
8 |
9 |
10 | 
11 |
12 |
13 |
14 | # Learn Js 🔥
15 |
16 |

17 |
18 |
Elzero Web School Js Course Assignments Solutions 💻
19 |
20 |
21 | ## 1️⃣ Introduction
22 | #### [codes for lessons from [001] to [009]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week1)
23 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week1/assignment%201)
24 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week1/assignment%202)
25 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week1/assignment%203)
26 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week1/assignment%204)
27 | [ • Assignment 5](https://github.com/HalemoGPA/Learn-Js/tree/main/Week1/Assignment%205)
28 | [ • Assignment 6](https://github.com/HalemoGPA/Learn-Js/tree/main/Week1/Assignment%206)
29 | ## 2️⃣ Data Types And Variables
30 | #### [codes for lessons from [010] to [017]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week2)
31 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week2/Assignment1)
32 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week2/Assignment2)
33 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week2/Assignment3)
34 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week2/Assignment4)
35 | ## 3️⃣ Operators
36 | #### [codes for lessons from [018] to [022]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week3)
37 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week3/Assignment1)
38 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week3/Assignment2)
39 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week3/Assignment3)
40 |
41 | ## 4️⃣ Numbers
42 | #### [codes for lessons from [023] to [026]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week4)
43 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week4/Assignment1)
44 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week4/Assignment2)
45 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week4/Assignment3)
46 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week4/Assignment4)
47 | [ • Assignment 5](https://github.com/HalemoGPA/Learn-Js/tree/main/Week4/Assignment5)
48 | [ • Assignment 6](https://github.com/HalemoGPA/Learn-Js/tree/main/Week4/Assignment6)
49 | [ • Assignment 7](https://github.com/HalemoGPA/Learn-Js/tree/main/Week4/Assignment7)
50 |
51 | ## 5️⃣ Strings And Methods
52 | #### [codes for lessons from [027] to [030]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week5)
53 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week5/Assignment1)
54 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week5/Assignment2)
55 |
56 |
57 |
58 | ## 6️⃣ Comparison & Logical Operators
59 | #### [codes for lessons from [031] to [032]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week6)
60 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week6/Assignment1)
61 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week6/Assignment2)
62 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week6/Assignment3)
63 |
64 |
65 | ## 7️⃣ If Condition
66 | #### [codes for lessons from [033] to [037]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week7)
67 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week7/Assignment1)
68 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week7/Assignment2)
69 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week7/Assignment3)
70 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week7/Assignment4)
71 |
72 |
73 | ## 8️⃣ Switch Statement
74 | #### [codes for lessons from [038] to [039]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week8/)
75 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week8/Assignment1)
76 |
77 |
78 |
79 | ## 9️⃣ Arrays And Methods
80 | #### [codes for lessons from [040] to [047]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week9)
81 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week9/Assignment1)
82 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week9/Assignment2)
83 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week9/Assignment3)
84 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week9/Assignment4)
85 | [ • Assignment 5](https://github.com/HalemoGPA/Learn-Js/tree/main/Week9/Assignment5)
86 | [ • Assignment 6](https://github.com/HalemoGPA/Learn-Js/tree/main/Week9/Assignment6)
87 |
88 |
89 | ## 🔟 Loop - For
90 | #### [codes for lessons from [048] to [053]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week10)
91 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week10/Assignment1)
92 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week10/Assignment2)
93 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week10/Assignment3)
94 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week10/Assignment4)
95 | [ • Assignment 5](https://github.com/HalemoGPA/Learn-Js/tree/main/Week10/Assignment5)
96 | [ • Assignment 6](https://github.com/HalemoGPA/Learn-Js/tree/main/Week10/Assignment6)
97 | [ • Assignment 7](https://github.com/HalemoGPA/Learn-Js/tree/main/Week10/Assignment7)
98 |
99 | ## 1️⃣1️⃣ Loop - While
100 | #### [codes for lessons from [054] to [056]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week11/)
101 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week11/Assignment1)
102 |
103 |
104 |
105 | ## 1️⃣2️⃣ Function And Parameters
106 | #### [codes for lessons from [057] to [063]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week12)
107 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week12/Assignment1)
108 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week12/Assignment2)
109 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week12/Assignment3)
110 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week12/Assignment4)
111 | [ • Assignment 5](https://github.com/HalemoGPA/Learn-Js/tree/main/Week12/Assignment5)
112 | [ • Assignment 6](https://github.com/HalemoGPA/Learn-Js/tree/main/Week12/Assignment6)
113 |
114 |
115 | ## 1️⃣3️⃣ Function And Scopes
116 | #### [codes for lessons from [064] to [070]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week13)
117 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week13/Assignment1)
118 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week13/Assignment2)
119 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week13/Assignment3)
120 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week13/Assignment4)
121 |
122 |
123 | ## 1️⃣4️⃣ Higher Order Functions
124 | #### [codes for lessons from [071] to [078]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week14)
125 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week14/Assignment1)
126 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week14/Assignment2)
127 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week14/Assignment3)
128 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week14/Assignment4)
129 | [ • Assignment 5](https://github.com/HalemoGPA/Learn-Js/tree/main/Week14/Assignment5)
130 |
131 |
132 |
133 |
134 | ## 1️⃣5️⃣ Objects And Methods
135 | #### [codes for lessons from [079] to [085]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week15)
136 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week15/Assignment1)
137 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week15/Assignment2)
138 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week15/Assignment3)
139 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week15/Assignment4)
140 |
141 |
142 |
143 |
144 | ## 1️⃣6️⃣ Document Object Model
145 | #### [codes for lessons from [086] to [093]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week16)
146 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week16/Assignment1)
147 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week16/Assignment2)
148 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week16/Assignment3)
149 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week16/Assignment4)
150 | [ • Assignment 5](https://github.com/HalemoGPA/Learn-Js/tree/main/Week16/Assignment5)
151 | [ • Assignment 6](https://github.com/HalemoGPA/Learn-Js/tree/main/Week16/Assignment6)
152 |
153 | ## 1️⃣7️⃣ Document Object Model
154 | #### [codes for lessons from [094] to [101]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week17)
155 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week17/Assignment1)
156 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week17/Assignment2)
157 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week17/Assignment3)
158 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week17/Assignment4)
159 | [ • Assignment 5](https://github.com/HalemoGPA/Learn-Js/tree/main/Week17/Assignment5)
160 |
161 | ## 1️⃣8️⃣ Browser Object Model
162 | #### [codes for lessons from [102] to [110]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week18)
163 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week18/Assignment1)
164 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week18/Assignment2)
165 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week18/Assignment3)
166 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week18/Assignment4)
167 | [ • Assignment 5](https://github.com/HalemoGPA/Learn-Js/tree/main/Week18/Assignment5)
168 |
169 |
170 | ## 1️⃣9️⃣ Browser Object Model
171 | #### [codes for lessons from [111] to [114]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week19)
172 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week19/Assignment1)
173 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week19/Assignment2)
174 |
175 |
176 |
177 | ## 2️⃣0️⃣ Destructuring
178 | #### [codes for lessons from [115] to [122]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week20)
179 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week20/Assignment1)
180 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week20/Assignment2)
181 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week20/Assignment3)
182 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week20/Assignment4)
183 | [ • Assignment 5](https://github.com/HalemoGPA/Learn-Js/tree/main/Week20/Assignment5)
184 | [ • Assignment 6](https://github.com/HalemoGPA/Learn-Js/tree/main/Week20/Assignment6)
185 |
186 |
187 | ## 2️⃣1️⃣ Map And Set
188 | #### [codes for lessons from [123] to [133]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week21)
189 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week21/Assignment1)
190 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week21/Assignment2)
191 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week21/Assignment3)
192 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week21/Assignment4)
193 | [ • Assignment 5](https://github.com/HalemoGPA/Learn-Js/tree/main/Week21/Assignment5)
194 | [ • Assignment 6](https://github.com/HalemoGPA/Learn-Js/tree/main/Week21/Assignment6)
195 | [ • Assignment 7](https://github.com/HalemoGPA/Learn-Js/tree/main/Week21/Assignment7)
196 | [ • Assignment 8](https://github.com/HalemoGPA/Learn-Js/tree/main/Week21/Assignment8)
197 |
198 |
199 | ## 2️⃣2️⃣ Regular Expression
200 | #### [codes for lessons from [134] to [146]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week22)
201 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week22/Assignment1)
202 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week22/Assignment2)
203 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week22/Assignment3)
204 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week22/Assignment4)
205 | [ • Assignment 5](https://github.com/HalemoGPA/Learn-Js/tree/main/Week22/Assignment5)
206 | [ • Assignment 6](https://github.com/HalemoGPA/Learn-Js/tree/main/Week22/Assignment6)
207 |
208 |
209 |
210 |
211 | ## 2️⃣3️⃣ Object Oriented Programming
212 | #### [codes for lessons from [147] to [158]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week23)
213 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week23/Assignment1)
214 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week23/Assignment2)
215 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week23/Assignment3)
216 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week23/Assignment4)
217 | [ • Assignment 5](https://github.com/HalemoGPA/Learn-Js/tree/main/Week23/Assignment5)
218 |
219 |
220 | ## 2️⃣4️⃣ Date, Generators, Modules
221 | #### [codes for lessons from [159] to [168]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week24)
222 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week24/Assignment1)
223 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week24/Assignment2)
224 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week24/Assignment3)
225 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week24/Assignment4)
226 | [ • Assignment 5](https://github.com/HalemoGPA/Learn-Js/tree/main/Week24/Assignment5)
227 | [ • Assignment 6](https://github.com/HalemoGPA/Learn-Js/tree/main/Week24/Assignment6)
228 | [ • Assignment 7](https://github.com/HalemoGPA/Learn-Js/tree/main/Week24/Assignment7)
229 | [ • Assignment 8](https://github.com/HalemoGPA/Learn-Js/tree/main/Week24/Assignment8)
230 |
231 | ## 2️⃣5️⃣ AJAX And JSON
232 | #### [codes for lessons from [169] to [178]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week25)
233 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week25/Assignment1)
234 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week25/Assignment2)
235 | [ • Assignment 3](https://github.com/HalemoGPA/Learn-Js/tree/main/Week25/Assignment3)
236 | [ • Assignment 4](https://github.com/HalemoGPA/Learn-Js/tree/main/Week25/Assignment4)
237 |
238 |
239 | ## 2️⃣6️⃣ Promises
240 | #### [codes for lessons from [179] to [188]](https://github.com/HalemoGPA/Learn-Js/tree/main/Week26)
241 | [ • Assignment 1](https://github.com/HalemoGPA/Learn-Js/tree/main/Week26/Assignment1)
242 | [ • Assignment 2](https://github.com/HalemoGPA/Learn-Js/tree/main/Week26/Assignment2)
243 |
244 |
245 |
246 |
247 |
248 |

249 |
250 |
251 |
252 |
--------------------------------------------------------------------------------
/Week1/Assignment 5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Week1/Assignment 5/main.js:
--------------------------------------------------------------------------------
1 | console.log();
2 | console.table(["Elzero", "Ahmed", "Sameh", "Gamal", "Ali"]);
3 |
--------------------------------------------------------------------------------
/Week1/Assignment 6/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Week1/Assignment 6/main.js:
--------------------------------------------------------------------------------
1 | // First way be commenting the code with single line comment
2 | // like this
3 | //console.log("Iam In Console");
4 | //document.write("Iam In Page");
5 |
6 | /* Second way be commenting the code with multiline comment
7 | console.log("Iam In Console");
8 | document.write("Iam In Page");
9 | */
10 |
--------------------------------------------------------------------------------
/Week1/assignment 1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Learn JavaScript
7 |
15 |
21 |
22 |
23 | Page Title
24 |
28 |
29 |
--------------------------------------------------------------------------------
/Week1/assignment 1/main.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalemoGPA/Learn-Js/0807ce25f6ed96f88ddc4bc443d5c4781300c205/Week1/assignment 1/main.js
--------------------------------------------------------------------------------
/Week1/assignment 2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Week1/assignment 2/main.js:
--------------------------------------------------------------------------------
1 | document.write("Elzero
");
2 | let Elzero = document.getElementsByTagName("h1")[0];
3 | Elzero.style.color = "blue";
4 | Elzero.style.font = "bold 80px Arial";
5 | Elzero.style.textAlign = "center";
6 |
--------------------------------------------------------------------------------
/Week1/assignment 3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Week1/assignment 3/main.js:
--------------------------------------------------------------------------------
1 | console.log(
2 | "%cElzero %cWeb %cSchool",
3 | "color:red ;font-size:40px",
4 | "color:green;weight:Bold;font-size:40px",
5 | "color:white;weight:Bold;background-color:blue;font-size:40px"
6 | );
7 |
--------------------------------------------------------------------------------
/Week1/assignment 4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Week1/assignment 4/main.js:
--------------------------------------------------------------------------------
1 | console.group("Group1");
2 | console.log("Message One");
3 | console.log("Message Two");
4 | console.group("Child Group");
5 | console.log("Message One");
6 | console.log("Message Two");
7 | console.group("Grand Child Group");
8 | console.log("Message One");
9 | console.log("Message Two");
10 | console.groupEnd();
11 | console.groupEnd();
12 | console.groupEnd();
13 | console.group("Group2");
14 | console.log("Message One");
15 | console.log("Message Two");
16 |
--------------------------------------------------------------------------------
/Week10/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Week10/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | let start = 10;
2 | let end = 100;
3 | let exclude = 40;
4 | for (let i = start; i <= end; i += start) {
5 | if (i == exclude) continue;
6 | console.log(i);
7 | }
8 |
--------------------------------------------------------------------------------
/Week10/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Week10/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let start = 10;
2 | let end = 0;
3 | let stop = 3;
4 |
5 | for (let i = start; i >= end; i--) {
6 | console.log(i < 10 ? "0" + i : i);
7 | if (i == stop) break;
8 | }
9 |
--------------------------------------------------------------------------------
/Week10/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Week10/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | let start = 1;
2 | let end = 6;
3 | let breaker = 2;
4 | for (let i = start; i <= end; i++) {
5 | console.log(i);
6 | console.log(`-- ${breaker}`);
7 | console.log(`-- ${end - breaker}`);
8 | }
9 |
--------------------------------------------------------------------------------
/Week10/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Week10/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | let index = 10;
2 | let jump = 2;
3 | let end = 0;
4 |
5 | for (;;) {
6 | if (index <= jump) break;
7 | console.log(index);
8 | index -= jump;
9 | }
10 |
--------------------------------------------------------------------------------
/Week10/Assignment5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Week10/Assignment5/main.js:
--------------------------------------------------------------------------------
1 | let friends = ["Ahmed", "Sayed", "Eman", "Mahmoud", "Ameer", "Osama", "Sameh"];
2 | let letter = "a";
3 |
4 | for (let i = letter.indexOf(letter); i < friends.length; i++) {
5 | if (friends[i].startsWith(letter.toUpperCase())) {
6 | friends.splice(i, letter.length);
7 | }
8 | }
9 | for (let i = letter.indexOf(letter); i < friends.length; i++) {
10 | console.log(`${i + letter.length} => ${friends[i]}`);
11 | }
12 |
--------------------------------------------------------------------------------
/Week10/Assignment6/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Week10/Assignment6/main.js:
--------------------------------------------------------------------------------
1 | let start = 0;
2 | let swappedName = "elZerO";
3 | let name = [];
4 | for (let i = start; i < swappedName.length; i++) {
5 | if (swappedName[i] == swappedName[i].toUpperCase()) {
6 | name.push(swappedName[i].toLowerCase());
7 | } else {
8 | name.push(swappedName[i].toUpperCase());
9 | }
10 | }
11 | console.log(name.join(""));
12 |
--------------------------------------------------------------------------------
/Week10/Assignment7/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Week10/Assignment7/main.js:
--------------------------------------------------------------------------------
1 | let start = 0;
2 | let mix = [1, 2, 3, "A", "B", "C", 4];
3 |
4 | for (let i = start; i < mix.length; i++) {
5 | if (i == start) continue;
6 | if (typeof mix[i] === "number") {
7 | console.log(mix[i]);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Week11/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Week11/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | let friends = ["Ahmed", "Sayed", "Ali", 1, 2, "Mahmoud", "Amany"];
2 | let index = 0;
3 | let counter = 0;
4 |
5 | while (index < friends.length) {
6 | index += counter.toFixed(counter).length;
7 | if (typeof friends[index] === "string" && !friends[index].startsWith("A")) {
8 | console.log(friends[index]);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Week12/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week12/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | function sayHello(theName, theGender) {
2 | if (theGender === "Male") console.log(`Hello Mr ${theName}`);
3 | else if (theGender === "Female") console.log(`Hello Miss ${theName}`);
4 | else console.log(`Hello ${theName}`);
5 | }
6 | // Needed Output
7 | sayHello("Osama", "Male"); // "Hello Mr Osama"
8 | sayHello("Eman", "Female"); // "Hello Miss Eman"
9 | sayHello("Sameh"); // "Hello Sameh"
10 |
--------------------------------------------------------------------------------
/Week12/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week12/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | function calculate(firstNum, secondNum, operation) {
2 | if (secondNum == undefined) {
3 | console.log("Second Number Not Found");
4 | } else {
5 | if (operation == "add") console.log(firstNum + secondNum);
6 | else if (operation == "subtract") console.log(firstNum - secondNum);
7 | else if (operation == "multiply") console.log(firstNum * secondNum);
8 | else if (operation == undefined) console.log(firstNum + secondNum);
9 | }
10 | }
11 |
12 | // Needed Output
13 | calculate(20); // Second Number Not Found
14 | calculate(20, 30); // 50
15 | calculate(20, 30, "add"); // 50
16 | calculate(20, 30, "subtract"); // -10
17 | calculate(20, 30, "multiply"); // 600
18 |
--------------------------------------------------------------------------------
/Week12/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week12/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | function ageInTime(theAge) {
2 | if (theAge > 10 && theAge <= 100) {
3 | console.log(`${theAge} years`);
4 | console.log(`${theAge * 12} months`);
5 | console.log(`${theAge * 12 * 4} weeks`);
6 | console.log(`${theAge * 12 * 4 * 7} days`);
7 | console.log(`${theAge * 12 * 4 * 7 * 24} hours`);
8 | console.log(`${theAge * 12 * 4 * 7 * 24 * 60} minutes`);
9 | console.log(`${theAge * 12 * 4 * 7 * 24 * 60 * 60} seconds`);
10 | } else console.log("Age Out Of Range");
11 | }
12 | // Needed Output
13 | ageInTime(110); // Age Out Of Range
14 | ageInTime(38); // Months Example => 456 Months
15 |
--------------------------------------------------------------------------------
/Week12/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week12/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | function checkStatus(a, b, c) {
2 | let first = typeof a;
3 | let second = typeof b;
4 | let third = typeof c;
5 | let arrange = [];
6 | first == "string"? arrange.push(a): second == "string"? arrange.push(b): arrange.push(c);
7 | first == "number"? arrange.push(a): second == "number"? arrange.push(b): arrange.push(c);
8 | first == "boolean"? arrange.push(a): second == "boolean"? arrange.push(b): arrange.push(c);
9 | arrange[2] == true? (arrange[2] = "Available"): (arrange[2] = "Not Available");console.log(`Hello ${arrange[0]}, Your Age Is ${arrange[1]}, You are ${arrange[2]} For Hire`);
10 | }
11 |
12 | // Needed Output
13 | checkStatus("Osama", 38, true); // "Hello Osama, Your Age Is 38, You Are Available For Hire"
14 | checkStatus(38, "Osama", true); // "Hello Osama, Your Age Is 38, You Are Available For Hire"
15 | checkStatus(true, 38, "Osama"); // "Hello Osama, Your Age Is 38, You Are Available For Hire"
16 | checkStatus(false, "Osama", 38); // "Hello Osama, Your Age Is 38, You Are Not Available For Hire"
17 |
--------------------------------------------------------------------------------
/Week12/Assignment5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week12/Assignment5/main.js:
--------------------------------------------------------------------------------
1 | function createSelectBox(startYear, endYear) {
2 | document.write(``);
7 | }
8 | createSelectBox(2000, 2021);
9 |
--------------------------------------------------------------------------------
/Week12/Assignment6/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week12/Assignment6/main.js:
--------------------------------------------------------------------------------
1 | function multiply(...numbers) {
2 | let result = 1;
3 | if (numbers.length === 0) {
4 | console.log(0);
5 | return 0;
6 | }
7 | for (let i = 0; i < numbers.length; i++) {
8 | if (typeof numbers[i] !== "number") continue;
9 | else {
10 | result *= Math.floor(numbers[i]);
11 | }
12 | }
13 | console.log(result);
14 | }
15 |
16 | multiply(10, 20); // 200
17 | multiply("A", 10, 30); // 300
18 | multiply(100.5, 10, "B"); // 1000
19 |
--------------------------------------------------------------------------------
/Week13/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week13/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | function getDetails(zName, zAge, zCountry) {
2 | function namePattern(zName) {
3 | let arr = zName.split(" ");
4 | agentName = arr[0] + " " + arr[1][0].toUpperCase() + ".";
5 | return agentName;
6 | }
7 | function ageWithMessage(zAge) {
8 | let arr = zAge.split(" ");
9 | agentAge = `Your Age Is ` + arr[0];
10 | return agentAge;
11 | }
12 | function countryTwoLetters(zCountry) {
13 | arr = zCountry.split("");
14 | return `You Live In ${(arr[0] + arr[1]).toUpperCase()}`;
15 | }
16 | function fullDetails() {
17 | return `Hello ${namePattern(zName)}, ${ageWithMessage(
18 | zAge
19 | )}, ${countryTwoLetters(zCountry)}`;
20 | }
21 | return fullDetails(); // Do Not Edit This
22 | }
23 |
24 | console.log(getDetails("Osama Mohamed", "38 Is My Age", "Egypt"));
25 | // Hello Osama M., Your Age Is 38, You Live In EG
26 |
27 | console.log(getDetails("Ahmed ali", "32 Is The Age", "Syria"));
28 | // Hello Ahmed A., Your Age Is 32, You Live In SY
29 |
--------------------------------------------------------------------------------
/Week13/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week13/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | // function itsMe() {
2 | // return `Iam A Normal Function`;
3 | // }
4 |
5 | itsMe = (_) => `Iam A Normal Function`;
6 | console.log(itsMe()); // Iam A Normal Function
7 |
8 | urlCreate = (protocol, web, tld) => `${protocol}://www.${web}.${tld}/HalemoGPA`;
9 |
10 | console.log(urlCreate("https", "github", "com")); // https://www.elzero.org
11 | //https://github.com/HalemoGPA
12 |
--------------------------------------------------------------------------------
/Week13/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week13/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | checker = (zName) => {
2 | return (status) => {
3 | return (salary) =>
4 | status === "Available"
5 | ? `${zName}, My Salary Is ${salary}`
6 | : `Iam Not Avaialble`;
7 | };
8 | };
9 |
10 | console.log(checker("Osama")("Available")(4000)); // Osama, My Salary Is 4000
11 | console.log(checker("Ahmed")("Not Available")()); // Iam Not Avaialble
12 |
--------------------------------------------------------------------------------
/Week13/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week13/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | function specialMix(...data) {
2 | sum = 0;
3 | for (let i = 0; i < data.length; i++) {
4 | let num = parseInt(data[i]);
5 | if (isNaN(num)) {
6 | num = 0;
7 | }
8 | sum += +num;
9 | }
10 | return sum == 0 ? "All Is Strings" : sum;
11 | }
12 |
13 | console.log(specialMix(10, 20, 30)); // 60
14 | console.log(specialMix("10Test", "Testing", "20Cool")); // 30
15 | console.log(specialMix("Testing", "10Testing", "40Cool")); // 50
16 | console.log(specialMix("Test", "Cool", "Test")); // All Is Strings
17 |
--------------------------------------------------------------------------------
/Week14/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week14/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | let mix = [1, 2, 3, "E", 4, "l", "z", "e", "r", 5, "o"];
2 | let arr = mix
3 | .map(function (letter) {
4 | return isNaN(letter) ? letter : "";
5 | })
6 | .reduce(function (acc, current) {
7 | return acc + current;
8 | });
9 | console.log(arr);
10 |
--------------------------------------------------------------------------------
/Week14/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week14/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let myString = "EElllzzzzzzzeroo";
2 | let arr = myString
3 | .split("")
4 | .filter(function (letter, index) {
5 | return letter !== myString[index + 1];
6 | })
7 | .reduce((acc, current) => acc + current);
8 | console.log(arr);
9 |
--------------------------------------------------------------------------------
/Week14/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week14/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | let myArray = ["E", "l", "z", ["e", "r"], "o"];
2 | let arr = myArray
3 | .reduce(function (acc, current) {
4 | return acc + current;
5 | })
6 | .split(",")
7 | .reduce((acc, current) => acc + current);
8 | console.log(arr);
9 |
--------------------------------------------------------------------------------
/Week14/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week14/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | let numsAndStrings = [1, 10, -10, -20, 5, "A", 3, "B", "C"];
2 | let newarr = numsAndStrings
3 | .filter(function (character) {
4 | return !isNaN(character);
5 | })
6 | .map(function (character) {
7 | return -character;
8 | });
9 | console.log(newarr);
10 | // [-1, -10, 10, 20, -5, -3]
11 |
--------------------------------------------------------------------------------
/Week14/Assignment5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week14/Assignment5/main.js:
--------------------------------------------------------------------------------
1 | let nums = [2, 12, 11, 5, 10, 1, 99];
2 | result = nums.reduce(function (acc, current) {
3 | return current % 2 == 0 ? acc * current : acc + current;
4 | }, 1);
5 | console.log(result);
6 | // 500
7 |
--------------------------------------------------------------------------------
/Week15/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week15/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | // Create Your Object Here
2 | member = {
3 | name: "Elzero",
4 | age: 38,
5 | country: "Egypt",
6 | fullDetails: function () {
7 | return `My Name Is ${this.name}, My Age Is ${this.age}, I live in ${this.country}`;
8 | },
9 | };
10 |
11 | console.log(member.name); // Elzero
12 | console.log(member.age); // 38
13 | console.log(member.country); // Egypt
14 | console.log(member.fullDetails());
15 | // My Name Is Elzero, My Age Is 38, I Live in Egypt
16 |
--------------------------------------------------------------------------------
/Week15/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week15/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | //
2 | objMethodOne = {
3 | property: "Method One",
4 | };
5 | console.log(objMethodOne.property); // "Method One"
6 |
7 | //
8 | objMethodTwo = new Object({ property: "Method Two" });
9 | console.log(objMethodTwo.property); // "Method Two"
10 |
11 | //
12 | objMethodThree = Object.create({ property: "Method Three" });
13 | console.log(objMethodThree.property); // "Method Three"
14 |
15 | //
16 | objMethodFour = Object.assign({ property: "Method Four" });
17 | console.log(objMethodFour.property); // "Method Four"
18 |
--------------------------------------------------------------------------------
/Week15/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week15/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | let a = 1;
2 |
3 | let threeNums = {
4 | b: 2,
5 | c: 3,
6 | d: 4,
7 | };
8 |
9 | let twoNums = {
10 | e: 5,
11 | f: 6,
12 | };
13 |
14 | // Create Your Object Here in One Line
15 | finalObject = Object.assign(twoNums, threeNums, { a: a });
16 | console.log(finalObject);
17 |
18 | /*
19 | a: 1
20 | b: 2
21 | c: 3
22 | d: 4
23 | e: 5
24 | f: 6
25 | */
26 |
--------------------------------------------------------------------------------
/Week15/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week15/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | // The Object To Work With
2 | let myFavGames = {
3 | "Trinity Universe": {
4 | publisher: "NIS America",
5 | price: 40,
6 | },
7 | "Titan Quest": {
8 | publisher: "THQ",
9 | bestThree: {
10 | one: "Immortal Throne",
11 | two: "Ragnarök",
12 | three: "Atlantis",
13 | },
14 | price: 50,
15 | },
16 | YS: {
17 | publisher: "Falcom",
18 | bestThree: {
19 | one: "Oath in Felghana",
20 | two: "Ark Of Napishtim",
21 | three: "origin",
22 | },
23 | price: 40,
24 | },
25 | };
26 |
27 | // Code One => How To Get Object Length ?
28 | let objectLength = Object.keys(myFavGames).length;
29 | for (let i = 0; i < objectLength; i++) {
30 | console.log(`The Game Name Is ${Object.keys(myFavGames)[i]}`);
31 | console.log(`The Publisher Is ${Object.values(myFavGames)[i].publisher}`);
32 | console.log(`The Price Is ${Object.values(myFavGames)[i].price}`);
33 |
34 | // Check If Nested Object Has Property (bestThree)
35 | if (Object.values(myFavGames)[i]["bestThree"]) {
36 | console.log("- Game Has Releases");
37 | console.log(`First => ${Object.values(myFavGames)[i]["bestThree"]["one"]}`);
38 | console.log(
39 | `Second => ${Object.values(myFavGames)[i]["bestThree"]["two"]}`
40 | );
41 | console.log(
42 | `Third => ${Object.values(myFavGames)[i]["bestThree"]["three"]}`
43 | );
44 | }
45 | console.log("#".repeat(20));
46 | }
47 |
48 | // Ouput
49 |
50 | ("The Game Name Is Trinity Universe");
51 | ("The Publisher Is NIS America");
52 | ("The Price Is 40");
53 | ("####################");
54 | ("The Game Name Is Titan Quest");
55 | ("The Publisher Is THQ");
56 | ("The Price Is 50");
57 | ("- Game Has Releases");
58 | ("First => Immortal Throne");
59 | ("Second => Ragnarök");
60 | ("Third => Atlantis");
61 | ("####################");
62 | ("The Game Name Is YS");
63 | ("The Publisher Is Falcom");
64 | ("The Price Is 40");
65 | ("- Game Has Releases");
66 | ("First => Oath in Felghana");
67 | ("Second => Ark Of Napishtim");
68 | ("Third => origin");
69 | ("####################");
70 |
--------------------------------------------------------------------------------
/Week16/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 | JavaScript
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Week16/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | let myElement1 = document.getElementById("elzero");
2 | let myElement2 = document.getElementsByTagName("div")[0];
3 | let myElement3 = document.getElementsByClassName("element")[0];
4 | let myElement4 = document.getElementsByTagNameNS("*", "div")[0];
5 | let myElement5 = document.querySelector("div");
6 | let myElement6 = document.querySelector(".element");
7 | let myElement7 = document.querySelector("#elzero");
8 | let myElement8 = document.querySelector('[name="js"]');
9 | let myElement9 = document.querySelectorAll("div")[0];
10 | let myElement10 = document.querySelectorAll(".element")[0];
11 | let myElement11 = document.querySelectorAll("#elzero")[0];
12 | let myElement12 = document.querySelectorAll('[name="js"]')[0];
13 | let myElement13 = document.body.children[0];
14 | let myElement14 = document.body.firstElementChild;
15 | let myElement15 = document.body.childNodes[1];
16 |
--------------------------------------------------------------------------------
/Week16/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
11 |
12 |
13 |
14 |

15 |
16 |
17 |

18 |
19 |
20 |

21 |
22 |
23 |

24 |
25 |
26 |

27 |
28 |
29 |

30 |
31 |
32 |

33 |
34 |
35 |

36 |
37 |
38 |

39 |
40 |
41 |

42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/Week16/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let myElements = document.getElementsByTagName("img");
2 | for (let i = 0; i < myElements.length; i++) {
3 | myElements[i].src =
4 | "https://elzero.org/wp-content/themes/elzero/imgs/logo.png";
5 | myElements[i].alt = "Elzero Elzero Logo";
6 | }
7 |
--------------------------------------------------------------------------------
/Week16/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Week16/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | let divElement = document.getElementsByTagName("div")[0];
2 | let myInput = document.getElementsByTagName("input")[0];
3 |
4 | myInput.oninput = function () {
5 | let value = parseFloat(myInput.value);
6 | if (myInput.value == "") {
7 | divElement.textContent = "{0} USD Dollar = {0} Egyptian Pound";
8 | } else {
9 | divElement.textContent = `${value.toFixed(2)} USD Dollar = ${(
10 | value * 15.6
11 | ).toFixed(2)} Egyptian Pound`;
12 | }
13 | };
14 |
--------------------------------------------------------------------------------
/Week16/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 | Two
11 | One
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week16/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | let myFirstDiv = document.querySelector(".one");
2 | let mySecondDiv = document.querySelector(".two");
3 | let textTemp = myFirstDiv.textContent;
4 | let classTemp = myFirstDiv.className;
5 | let titleTemp = myFirstDiv.title;
6 | myFirstDiv.textContent = mySecondDiv.textContent;
7 | myFirstDiv.className = mySecondDiv.className;
8 | myFirstDiv.title = mySecondDiv.title;
9 | mySecondDiv.textContent =
10 | textTemp +
11 | document.body.firstChild.textContent +
12 | document.querySelectorAll("div").length;
13 | mySecondDiv.className = classTemp;
14 | mySecondDiv.title = titleTemp;
15 |
--------------------------------------------------------------------------------
/Week16/Assignment5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Week16/Assignment5/main.js:
--------------------------------------------------------------------------------
1 | let myImages = document.querySelectorAll("img");
2 | for (let i = 0; i < myImages.length; i++) {
3 | if (myImages[i].alt == "") {
4 | myImages[i].alt = "Elzero New";
5 | } else {
6 | myImages[i].alt = "Old";
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Week16/Assignment6/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Week16/Assignment6/main.js:
--------------------------------------------------------------------------------
1 | let type = document.querySelector("select");
2 | let theResult = document.getElementsByClassName("results")[0];
3 | let number = document.querySelector('[name="elements"]');
4 | let text = document.querySelector('[name="texts"]');
5 | document.forms[0].onsubmit = function (event) {
6 | event.preventDefault();
7 | let div = document.createElement("div");
8 | let section = document.createElement("section");
9 | let divText = document.createTextNode(text.value);
10 | let sectionText = document.createTextNode(text.value);
11 | div.setAttribute("class", "box");
12 | div.setAttribute("title", "Element");
13 | section.setAttribute("class", "box");
14 | section.setAttribute("title", "Element");
15 | div.appendChild(divText);
16 | section.appendChild(sectionText);
17 | if (type.value == "Div") {
18 | for (let i = 0; i < Number(number.value); i++) {
19 | div.setAttribute("id", `id-${i + 1}`);
20 | theResult.appendChild(div.cloneNode(true));
21 | }
22 | } else {
23 | for (let i = 0; i < Number(number.value); i++) {
24 | section.setAttribute("id", `id-${i + 1}`);
25 | theResult.appendChild(section.cloneNode(true));
26 | }
27 | }
28 | };
29 |
--------------------------------------------------------------------------------
/Week17/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
18 |
19 |
20 | Google
21 | Elzero
22 | Facebook
23 | Elzero
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Week17/Assignment1/main.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalemoGPA/Learn-Js/0807ce25f6ed96f88ddc4bc443d5c4781300c205/Week17/Assignment1/main.js
--------------------------------------------------------------------------------
/Week17/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
51 |
52 |
53 |
54 |
55 |
56 |
Current Element
57 |
58 |
Current Element Class Lists
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/Week17/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let currentElement = document.querySelector('[title="Current"]');
2 | let toRemove = document.querySelector(".classes-to-remove");
3 | let toAdd = document.querySelector(".classes-to-add");
4 | spanParent = document.querySelector(".classes-list div");
5 | toAdd.onblur = function () {
6 | spanParent.innerHTML = "";
7 | let value = toAdd.value.split(" ");
8 | for (let i = 0; i < value.length; i++) {
9 | valueLowered = value[i].toLowerCase();
10 | currentElement.classList.add(valueLowered);
11 | toAdd.value = "";
12 | }
13 |
14 | for (let i = 0; i < currentElement.classList.length; i++) {
15 | let span = document.createElement("span").cloneNode(true);
16 | spantext = document.createTextNode(currentElement.classList[i]);
17 | span.appendChild(spantext);
18 | spanParent.appendChild(span);
19 | }
20 | };
21 | toRemove.onblur = function () {
22 | spanParent.innerHTML = "";
23 | let value = toRemove.value.split(" ");
24 | for (let i = 0; i < value.length; i++) {
25 | valueLowered = value[i].toLowerCase();
26 | currentElement.classList.remove(valueLowered);
27 | toRemove.value = "";
28 | }
29 | for (let i = 0; i < currentElement.classList.length; i++) {
30 | let span = document.createElement("span").cloneNode(true);
31 | spantext = document.createTextNode(currentElement.classList[i]);
32 | span.appendChild(spantext);
33 | spanParent.appendChild(span);
34 | }
35 | };
36 |
--------------------------------------------------------------------------------
/Week17/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 | Our Element
11 | Paragraph
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Week17/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | let ourDiv = document.querySelector(".our-element");
2 | let ourP = document.querySelector("p");
3 | ourP.remove();
4 | let beforeDiv = document.createElement("div").cloneNode(true);
5 | beforeDiv.setAttribute("class", "start");
6 | beforeDiv.setAttribute("title", "Start Element");
7 | beforeDiv.setAttribute("data-value", "Start");
8 | beforeDiv.innerHTML = "Start";
9 | ourDiv.before(beforeDiv);
10 | let afterDiv = document.createElement("div").cloneNode(true);
11 | afterDiv.setAttribute("class", "end");
12 | afterDiv.setAttribute("title", "End Element");
13 | afterDiv.setAttribute("data-value", "End");
14 | afterDiv.innerHTML = "End";
15 | ourDiv.after(afterDiv);
16 |
--------------------------------------------------------------------------------
/Week17/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 | Hello
12 |
13 | Elzero
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Week17/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | let span = document.querySelector("div span");
2 | let wordBefore = span.nextSibling.nextSibling.nextSibling;
3 | let wordAfter = wordBefore.textContent.trim();
4 | console.log(wordAfter);
5 |
--------------------------------------------------------------------------------
/Week17/Assignment5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 | Element
11 | Element
12 | Element
13 | Element
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Week17/Assignment5/main.js:
--------------------------------------------------------------------------------
1 | document.onclick = function (event) {
2 | event.preventDefault();
3 | console.log(`This is ${event.target.nodeName}`);
4 | };
5 |
--------------------------------------------------------------------------------
/Week18/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week18/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | let answer = prompt("Print Number From – To");
2 | let answerNums = answer.split("-");
3 | let start = Math.min(...answerNums);
4 | let end = Math.max(...answerNums);
5 | for (let i = start; i <= end; i++) {
6 | console.log(i);
7 | }
8 |
--------------------------------------------------------------------------------
/Week18/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Week18/Assignment2/main.css:
--------------------------------------------------------------------------------
1 | button {
2 | width: 40px;
3 | height: 40px;
4 | background-color: #f00;
5 | color: white;
6 | border: none;
7 | border-radius: 50%;
8 | cursor: pointer;
9 | position: absolute;
10 | top: -20px;
11 | right: -20px;
12 | }
13 |
14 | div {
15 | width: 600px;
16 | height: 200px;
17 | background-color: #EEE;
18 | border: 0.5px solid rgb(89, 89, 89);
19 | position: absolute;
20 | top: 50%;
21 | left: 50%;
22 | transform: translate(-50%, -50%);
23 | display: flex;
24 | flex-direction: column;
25 | justify-content: center;
26 |
27 | }
28 |
29 | h2 {
30 | text-align: center;
31 | }
32 |
33 | p {
34 | text-align: center;
35 | }
--------------------------------------------------------------------------------
/Week18/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let popup = function () {
2 | let myDiv = document.createElement("div");
3 | myDiv.classList = "my-div";
4 | myH2 = document.createElement("h2");
5 | myH2.textContent = "Welcome";
6 | myDiv.appendChild(myH2);
7 | myP = document.createElement("p");
8 | myP.textContent = "Welcome to Elzero Web School";
9 | myDiv.appendChild(myP);
10 | myButton = document.createElement("button");
11 | myButton.textContent = "X";
12 | myButton.addEventListener("click", function () {
13 | myDiv.remove();
14 | });
15 | myDiv.appendChild(myButton);
16 | setTimeout(function () {
17 | document.body.appendChild(myDiv);
18 | }, 5000);
19 | };
20 | popup();
21 |
--------------------------------------------------------------------------------
/Week18/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 | 10
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Week18/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | div = document.querySelector("div");
2 | let counter = setInterval(function () {
3 | div.textContent = +div.textContent - 1;
4 | if (+div.textContent === 0) {
5 | clearInterval(counter);
6 | }
7 | }, 1000);
8 |
--------------------------------------------------------------------------------
/Week18/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 | 10
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Week18/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | div = document.querySelector("div");
2 | let counter = setInterval(function () {
3 | div.textContent = +div.textContent - 1;
4 | if (+div.textContent === 0) {
5 | window.location.href = "https://elzero.org";
6 | }
7 | }, 1000);
8 |
--------------------------------------------------------------------------------
/Week18/Assignment5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 | 10
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Week18/Assignment5/main.js:
--------------------------------------------------------------------------------
1 | div = document.querySelector("div");
2 | let counter = setInterval(function () {
3 | div.textContent = +div.textContent - 1;
4 | if (+div.textContent === 5) {
5 | window.open(
6 | "https://elzero.org",
7 | "_blank",
8 | "width=400,height=400,top=200,left=600"
9 | );
10 | }
11 | if (+div.textContent === 0) {
12 | clearInterval(counter);
13 | }
14 | }, 1000);
15 |
--------------------------------------------------------------------------------
/Week19/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Week19/Assignment1/main.css:
--------------------------------------------------------------------------------
1 | /*
2 | font-family: 'Cairo', sans-serif;
3 | font-family: 'Open Sans', sans-serif;
4 | font-family: 'Roboto', sans-serif;
5 | */
6 | :root {
7 | --stable: 0px;
8 | }
9 |
10 | * {
11 | font-family: var(--font-family-s);
12 | }
13 |
14 |
15 | div {
16 | display: flex;
17 | flex-direction: column;
18 | align-items: center;
19 | justify-content: space-around;
20 | width: 200px;
21 | background-color: var(--color-s);
22 | padding: 60px 20px 60px;
23 | border-radius: 10px;
24 |
25 | }
26 |
27 | select {
28 |
29 | height: fit-content;
30 | min-height: 40px;
31 | background-color: #EEE;
32 | border-radius: 10px;
33 | border: none;
34 | outline: none;
35 | padding: 10px;
36 | width: 90%;
37 | margin-bottom: 50px;
38 | font-size: var(--font-size-s);
39 | }
--------------------------------------------------------------------------------
/Week19/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | let divContainer = document.createElement("div").cloneNode(true);
2 |
3 | let selectBox = document.createElement("select").cloneNode(true);
4 | let option = document.createElement("option").cloneNode(true);
5 | let optionList1 = ["Open", "Roboto", "Cairo"];
6 | let optionList2 = ["red", "blue", "green", "yellow", "pink", "black"];
7 |
8 | for (let i = 0; i < 3; i++) {
9 | option.value = optionList1[i].toLowerCase();
10 | let text = document.createTextNode(optionList1[i]);
11 | option.appendChild(text);
12 | selectBox.appendChild(option.cloneNode(true));
13 | if (selectBox.lastChild.value == window.localStorage.getItem("font-family")) {
14 | selectBox.lastChild.selected = true;
15 | }
16 | option.removeChild(option.lastChild);
17 | }
18 | selectBox.classList.add("font-family");
19 |
20 | divContainer.appendChild(selectBox.cloneNode(true));
21 | selectBox.classList.remove("font-family");
22 | for (let i = 0; i < 3; i++) {
23 | selectBox.removeChild(selectBox.lastChild);
24 | }
25 | for (let i = 0; i < 6; i++) {
26 | option.value = optionList2[i].toLowerCase();
27 | let text = document.createTextNode(optionList2[i]);
28 | option.appendChild(text);
29 | selectBox.appendChild(option.cloneNode(true));
30 | if (selectBox.lastChild.value == window.localStorage.getItem("color")) {
31 | selectBox.lastChild.selected = true;
32 | }
33 | option.removeChild(option.lastChild);
34 | }
35 | selectBox.classList.add("color");
36 |
37 | divContainer.appendChild(selectBox.cloneNode(true));
38 | selectBox.classList.remove("color");
39 | for (let i = 0; i < 6; i++) {
40 | selectBox.removeChild(selectBox.lastChild);
41 | }
42 | for (let i = 16; i < 16 + 15; i++) {
43 | option.value = i + "px";
44 | let text = document.createTextNode(i);
45 | option.appendChild(text);
46 | selectBox.appendChild(option.cloneNode(true));
47 | if (i == window.localStorage.getItem("font-size")) {
48 | selectBox.lastChild.selected = true;
49 | }
50 | option.removeChild(option.lastChild);
51 | }
52 | selectBox.classList.add("font-size");
53 |
54 | divContainer.appendChild(selectBox.cloneNode(true));
55 | selectBox.classList.remove("font-size");
56 | for (let i = 16; i < 16 + 15; i++) {
57 | selectBox.removeChild(selectBox.lastChild);
58 | }
59 |
60 | document.body.prepend(divContainer);
61 | let fontStorage = document.querySelector(".font-family");
62 | let colorStorage = document.querySelector(".color");
63 | let fontSizeStorage = document.querySelector(".font-size");
64 | window.addEventListener("load", function (e) {
65 | fontStorage.value = this.window.localStorage.getItem("font-family");
66 | colorStorage.value = this.window.localStorage.getItem("color");
67 | fontSizeStorage.value = this.window.localStorage.getItem("font-size");
68 | });
69 | //
70 | this.document.styleSheets[1].cssRules[0].style.setProperty(
71 | "--font-family-s",
72 | this.window.localStorage.getItem("font-family")
73 | );
74 | this.document.styleSheets[1].cssRules[0].style.setProperty(
75 | "--color-s",
76 | this.window.localStorage.getItem("color")
77 | );
78 | this.document.styleSheets[1].cssRules[0].style.setProperty(
79 | "--font-size-s",
80 | this.window.localStorage.getItem("font-size")
81 | );
82 | //
83 |
84 | window.addEventListener("change", function (e) {
85 | if (e.target.classList.contains("font-family")) {
86 | this.window.localStorage.setItem("font-family", e.target.value);
87 | } else if (e.target.classList.contains("color")) {
88 | this.window.localStorage.setItem("color", e.target.value);
89 | } else if (e.target.classList.contains("font-size")) {
90 | this.window.localStorage.setItem("font-size", e.target.value);
91 | }
92 | if (1) {
93 | this.document.styleSheets[1].cssRules[0].style.setProperty(
94 | "--font-family-s",
95 | this.window.localStorage.getItem("font-family")
96 | );
97 | this.document.styleSheets[1].cssRules[0].style.setProperty(
98 | "--color-s",
99 | this.window.localStorage.getItem("color")
100 | );
101 | this.document.styleSheets[1].cssRules[0].style.setProperty(
102 | "--font-size-s",
103 | this.window.localStorage.getItem("font-size")
104 | );
105 | }
106 | });
107 |
--------------------------------------------------------------------------------
/Week19/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Week19/Assignment2/main.css:
--------------------------------------------------------------------------------
1 | * {
2 | font-size: 1.1em;
3 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
4 | }
5 |
6 | form {
7 | display: flex;
8 | flex-direction: column;
9 | align-items: center;
10 | justify-content: space-around;
11 | width: 600px;
12 | min-height: 400px;
13 | height: fit-content;
14 | background-color: #00d79e;
15 | border-radius: 10px;
16 | padding: 20px;
17 | margin: auto;
18 | }
19 |
20 | input {
21 | background-color: rgb(9, 24, 24);
22 | width: 90%;
23 | height: 40px;
24 | border-radius: 5px;
25 | border: none;
26 | outline: none;
27 | padding: 5px;
28 | color: white;
29 | }
30 |
31 | select {
32 | width: 92%;
33 | height: 50px;
34 | border-radius: 5px;
35 | border: none;
36 | outline: none;
37 | padding: 5px;
38 |
39 | }
--------------------------------------------------------------------------------
/Week19/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let form = document.createElement("form");
2 | let input = document.createElement("input");
3 | let select = document.createElement("select");
4 | let option = document.createElement("option");
5 | let types = ["text", "password", "number"];
6 | let languages = ["English", "Arabic", "Spanish", "German", "French"];
7 | for (let i = 0; i < 3; i++) {
8 | input.setAttribute("type", types[i]);
9 | form.appendChild(input.cloneNode(true));
10 | }
11 | for (let i = 0; i < 5; i++) {
12 | option.setAttribute("value", languages[i]);
13 | let text = document.createTextNode(languages[i]);
14 | option.appendChild(text);
15 | select.appendChild(option.cloneNode(true));
16 | option.removeChild(option.lastChild);
17 | }
18 | form.appendChild(select);
19 | document.body.prepend(form);
20 | let inputText = document.querySelector("input[type=text]");
21 | let inputPassword = document.querySelector("input[type=password]");
22 | let inputNumber = document.querySelector("input[type=number]");
23 | let selectLanguage = document.querySelector("select");
24 | window.addEventListener("change", function (e) {
25 | window.sessionStorage.setItem("inputText", inputText.value);
26 | window.sessionStorage.setItem("inputPassword", inputPassword.value);
27 | window.sessionStorage.setItem("inputNumber", inputNumber.value);
28 | window.sessionStorage.setItem("selectLanguage", selectLanguage.value);
29 | inputText.value = window.sessionStorage.getItem("inputText");
30 | inputPassword.value = window.sessionStorage.getItem("inputPassword");
31 | inputNumber.value = window.sessionStorage.getItem("inputNumber");
32 | selectLanguage.value = window.sessionStorage.getItem("selectLanguage");
33 | });
34 | window.addEventListener("load", function (e) {
35 | inputText.value = window.sessionStorage.getItem("inputText");
36 | inputPassword.value = window.sessionStorage.getItem("inputPassword");
37 | inputNumber.value = window.sessionStorage.getItem("inputNumber");
38 | selectLanguage.value = window.sessionStorage.getItem("selectLanguage");
39 | });
40 |
--------------------------------------------------------------------------------
/Week2/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Week2/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | let numberOne = 10,
2 | numberTwo = 20;
3 | // normal concatinate
4 | console.log(numberOne + "" + numberTwo);
5 | // type of data using normal concatinate
6 | console.log(typeof (numberOne + "" + numberTwo));
7 | //using template literals
8 | console.log(`${numberOne}${numberTwo}`);
9 | //type of data using template literals
10 | console.log(typeof `${numberOne}${numberTwo}`);
11 | //using normal concatinate 20 then newline then 10
12 | console.log(numberTwo + "\n" + numberOne);
13 | //using template literals 20 then newline then 10
14 | console.log(`${numberTwo}\n${numberOne}`);
15 |
--------------------------------------------------------------------------------
/Week2/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 | object
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Week2/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | console.log(elzero.innerHTML);
2 | console.log(typeof elzero);
3 |
--------------------------------------------------------------------------------
/Week2/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Week2/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | console.log(
2 | '`I\'m In\n\\\\\nLove \\\\ """ \'\'\'\n++ with ++\n\\"""\\"""\n""Javascript""``'
3 | );
4 |
--------------------------------------------------------------------------------
/Week2/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Week2/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | let a = 21;
2 | let b = 20;
3 | let dd = (d = a);
4 | let ee = (e = b);
5 | let c = d + "" + e;
6 | console.log(`_${d}_${(c + "_").repeat(++dd % --ee)} ${++e}_`);
7 |
--------------------------------------------------------------------------------
/Week20/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week20/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | let myNumbers = [1, 2, 3, 4, 5];
2 | let [a, b, c, d, e] = myNumbers;
3 | console.log(a * e);
4 |
--------------------------------------------------------------------------------
/Week20/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week20/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let mySkills = [
2 | "HTML",
3 | "CSS",
4 | "JavaScript",
5 | ["PHP", "Python", ["Django", "Laravel"]],
6 | ];
7 |
8 | let [a, b, c, [d, e, [f, g]]] = mySkills;
9 |
10 | console.log(`My Skills: ${a}, ${b}, ${c}, ${d}, ${e}, ${f}, ${g}`);
11 |
12 | // My Skills: HTML, CSS, JavaScript, PHP, Python, Django, Laravel
13 |
--------------------------------------------------------------------------------
/Week20/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week20/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | let arr1 = ["Ahmed", "Sameh", "Sayed"];
2 | let arr2 = ["Mohamed", "Gamal", "Amir"];
3 | let arr3 = ["Haytham", "Shady", "Mahmoud"];
4 |
5 | let arr4 = arr1.concat(arr2, arr3);
6 |
7 | let [c, , , , , , , a, b] = arr4;
8 |
9 | console.log(`My Best Friends: ${a}, ${b}, ${c}`);
10 |
11 | // My Best Friends: Shady, Mahmoud, Ahmed
12 |
--------------------------------------------------------------------------------
/Week20/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week20/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | const member = {
2 | age: 30,
3 | working: false,
4 | country: "Egypt",
5 | hobbies: ["Reading", "Swimming", "Programming"],
6 | };
7 |
8 | const {
9 | age: a,
10 | working: w,
11 | country: c,
12 | hobbies: [h1, , h3],
13 | } = member;
14 |
15 | console.log(`My Age Is ${a} And Iam ${w ? "" : "Not"} Working`);
16 | // My Age Is 30 And Iam Not Working
17 |
18 | console.log(`I Live in ${c}`);
19 | // I Live in Egypt
20 |
21 | console.log(`My Hobbies: ${h1} And ${h3}`);
22 | // My Hobbies: Reading And Programming
23 |
--------------------------------------------------------------------------------
/Week20/Assignment5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week20/Assignment5/main.js:
--------------------------------------------------------------------------------
1 | const game = {
2 | title: "YS",
3 | developer: "Falcom",
4 | releases: {
5 | "Oath In Felghana": ["USA", "Japan"],
6 | "Ark Of Napishtim": {
7 | US: "20 USD",
8 | JAP: "10 USD",
9 | },
10 | Origin: "30 USD",
11 | },
12 | };
13 |
14 | let {
15 | title: t,
16 | developer: d,
17 | releases: { "Oath In Felghana": o, "Ark Of Napishtim": a, Origin: or },
18 | } = game;
19 | let [u, j] = o;
20 | let { US: u_price, JAP: j_price } = a;
21 | [o, a] = [Object.keys(game.releases)[0], Object.keys(game.releases)[1]];
22 |
23 | console.log(`My Favourite Games Style Is ${t} Style`);
24 | // My Favourite Games Style Is YS Style
25 |
26 | console.log(`And I Love ${d} Games`);
27 | // And I Love Falcom Games
28 |
29 | console.log(`My Best Release Is ${o} It Released in ${u} & ${j}`);
30 | // My Best Release Is Oath In Felghana It Released in USA & Japan
31 |
32 | console.log(`Although I Love ${a}`);
33 | // Although I Love Ark Of Napishtim
34 |
35 | console.log(`${a} Price in USA Is ${u_price}`);
36 | // Ark Of Napishtim Price in USA Is 20 USD
37 |
38 | console.log(`${a} Price in USA Is ${j_price}`);
39 | // Ark Of Napishtim Price in USA Is 10 USD
40 |
41 | console.log(`Origin Price Is ${or}`);
42 | // Origin Price Is 30 USD
43 |
--------------------------------------------------------------------------------
/Week20/Assignment6/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week20/Assignment6/main.js:
--------------------------------------------------------------------------------
1 | let chosen = 1;
2 |
3 | let myFriends = [
4 | { title: "Osama", age: 39, avaiable: true, skills: ["HTML", "CSS"] },
5 | { title: "Ahmed", age: 25, avaiable: false, skills: ["Python", "Django"] },
6 | { title: "Sayed", age: 33, avaiable: true, skills: ["PHP", "Laravel"] },
7 | ];
8 |
9 | function getFriend(choosed) {
10 | function destruct(
11 | { title, age, avaiable, skills: [, skill] } = myFriends[choosed - 1]
12 | ) {
13 | console.log(title);
14 | console.log(age);
15 | avaiable ? console.log("Available") : console.log("Not Available");
16 | console.log(skill);
17 | }
18 | destruct();
19 | }
20 | getFriend(chosen);
21 |
--------------------------------------------------------------------------------
/Week21/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week21/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | let setOfNumbers = new Set().add(10);
2 | setOfNumbers.add(20).add(setOfNumbers.size);
3 | console.log(setOfNumbers);
4 | console.log(+[...setOfNumbers].slice(setOfNumbers.size - 1));
5 |
--------------------------------------------------------------------------------
/Week21/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week21/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let myFriends = ["Osama", "Ahmed", "Sayed", "Sayed", "Mahmoud", "Osama"];
2 | console.log([...new Set(myFriends)].sort());
3 | // Needed Output
4 | // (4) ['Ahmed', 'Mahmoud', 'Osama', 'Sayed']
5 |
--------------------------------------------------------------------------------
/Week21/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week21/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | let myInfo = {
2 | username: "Osama",
3 | role: "Admin",
4 | country: "Egypt",
5 | };
6 | let myInfoMap = new Map(Object.entries(myInfo));
7 | console.log(myInfoMap);
8 | console.log(myInfoMap.size);
9 | console.log(myInfoMap.has("role"));
10 |
--------------------------------------------------------------------------------
/Week21/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week21/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | let theNumber = 100020003000;
2 | console.log(
3 | +[...new Set(theNumber.toString())]
4 | .filter(function (e) {
5 | return +e;
6 | })
7 | .join("")
8 | );
9 |
--------------------------------------------------------------------------------
/Week21/Assignment5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week21/Assignment5/main.js:
--------------------------------------------------------------------------------
1 | let theName = "Elzero";
2 | a1 = theName.split("");
3 | a2 = Array.from(theName);
4 | a3 = [...theName];
5 | a4 = Array(...theName);
6 | a5 = Array(theName)
7 | .map((x) => x.split(""))
8 | .flatMap((x) => x);
9 | console.log(a1);
10 | console.log(a2);
11 | console.log(a3);
12 | console.log(a4);
13 | console.log(a5);
14 |
--------------------------------------------------------------------------------
/Week21/Assignment6/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week21/Assignment6/main.js:
--------------------------------------------------------------------------------
1 | let chars = ["Z", "Y", "A", "D", "E", 10, 1];
2 | let numOfnums = chars.filter((x) => typeof x === "number");
3 | let newarr = [...numOfnums, ...chars.filter((x) => typeof x === "string")];
4 | console.log(newarr.copyWithin(0, numOfnums.length, numOfnums.length * 2));
5 |
--------------------------------------------------------------------------------
/Week21/Assignment7/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week21/Assignment7/main.js:
--------------------------------------------------------------------------------
1 | let numsOne = [1, 2, 3];
2 | let numsTwo = [4, 5, 6];
3 | let temp = numsOne.concat();
4 | let temp2 = numsTwo.concat();
5 | let all1 = [...numsOne, ...numsTwo];
6 | let all2 = numsOne.concat(numsTwo);
7 | let all3 = numsOne.concat(...numsTwo);
8 | temp.push(...numsTwo);
9 | console.log(temp);
10 | temp2.unshift(...numsOne);
11 | console.log(temp2);
12 | console.log(all1);
13 | console.log(all2);
14 | console.log(all3);
15 |
--------------------------------------------------------------------------------
/Week21/Assignment8/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week21/Assignment8/main.js:
--------------------------------------------------------------------------------
1 | let n1 = [10, 30, 10, 20];
2 | let n2 = [30, 20, 10];
3 | console.log([...n1, ...n2].length * Math.max(...n1, ...n2));
4 |
--------------------------------------------------------------------------------
/Week22/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week22/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | let ip = "2001:db8:3333:4444:5555:6666:7777:8888";
2 | let ipRe = /(\w+\d+:){7}/gi;
3 | console.log(ip.match(ipRe));
4 |
--------------------------------------------------------------------------------
/Week22/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week22/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let specialNames = "Os10O OsO Os100O Osa100O Os1000 Os100m";
2 | let specialNamesRe = /Os\d*O/gi;
3 | console.log(specialNames.match(specialNamesRe));
4 | // Output
5 | // ['Os10O', 'OsO', 'Os100O']
6 |
--------------------------------------------------------------------------------
/Week22/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week22/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | let phone = "+(995)-123 (4567)";
2 | let phoneRe = /\+\(\d{3}\)-\d{3} \(\d{4}\)/gi;
3 | console.log(phone.match(phoneRe));
4 |
--------------------------------------------------------------------------------
/Week22/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week22/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | let re = /https?:\/\/(?:[-\w]+\.)?([-\w]+)\.\w+(?:\.\w+)?\/?.*/i;
2 |
3 | // s? - optional
4 | // \/ - escape
5 | // ?: - non-capturing group
6 | // [-\w] - any character except whitespace
7 | // \. - period
8 | // .* - any character [0 or more]
9 | // \w+ - any word [1 or more]
10 | // i - case insensitive
11 |
--------------------------------------------------------------------------------
/Week22/Assignment5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week22/Assignment5/main.js:
--------------------------------------------------------------------------------
1 | let date1 = "25/10/1982";
2 | let date2 = "25 - 10 - 1982";
3 | let date3 = "25 10 1982";
4 | let date4 = "25 10 82";
5 |
6 | let re = /(\d+( |\/| - ))+\d+/gi;
7 |
8 | console.log(date1.match(re)); // "25/10/1982"
9 | console.log(date2.match(re)); // "25 - 10 - 1982"
10 | console.log(date3.match(re)); // "25 10 1982"
11 | console.log(date4.match(re)); // "25 10 82"
12 |
--------------------------------------------------------------------------------
/Week22/Assignment6/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week22/Assignment6/main.js:
--------------------------------------------------------------------------------
1 | let url1 = "elzero.org";
2 | let url2 = "http://elzero.org";
3 | let url3 = "https://elzero.org";
4 | let url4 = "https://www.elzero.org";
5 | let url5 = "https://www.elzero.org:8080/articles.php?id=100&cat=topics";
6 |
7 | let re = /(https?:\/\/)?(www.)?elzero.org(:?\d+\/\w+\.\w+\?id=\d+&cat=\w+)?/gi;
8 | console.log(url1.match(re));
9 | console.log(url2.match(re));
10 | console.log(url3.match(re));
11 | console.log(url4.match(re));
12 | console.log(url5.match(re));
13 |
--------------------------------------------------------------------------------
/Week23/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week23/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | class Car {
2 | constructor(name, model, price) {
3 | this.n = name;
4 | this.m = model;
5 | this.p = price;
6 | }
7 | run() {
8 | return `Car Is Running Now`;
9 | }
10 | stop() {
11 | return `Car Is Stopped`;
12 | }
13 | }
14 |
15 | carOne = new Car("MG", "2022", 420000);
16 | carTwo = new Car("Toyota", "2022", 450000);
17 | carTwo = new Car("Hyundai", "2022", 500000);
18 |
19 | console.log(
20 | `Car One Name Is ${carOne.n} And Model Is ${carOne.m} And Price Is ${carOne.p}`
21 | );
22 | console.log(carOne.run());
23 |
--------------------------------------------------------------------------------
/Week23/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week23/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | class Phone {
2 | constructor(name, serial, price) {
3 | this.name = name;
4 | this.serial = serial;
5 | this.price = price;
6 | }
7 | }
8 |
9 | // Write Tablet Class Here
10 | class Tablet extends Phone {
11 | constructor(name, serial, price, size) {
12 | super(name, serial, price);
13 | this.size = size || "Unknown";
14 | }
15 | fullDetails() {
16 | return `${this.name} Serial is ${this.serial} And size Is ${this.size}`;
17 | }
18 | }
19 |
20 | let TabletOne = new Tablet("iPad", 100200300, 1500, 12.9);
21 | let TabletTwo = new Tablet("Nokia", 350450650, 800, 10.5);
22 | let TabletThree = new Tablet("LG", 250450650, 650);
23 |
24 | console.log(`${TabletOne.fullDetails()}`);
25 | // iPad Serial is 100200300 And Size Is 12.9
26 |
27 | console.log(`${TabletTwo.fullDetails()}`);
28 | // Nokia Serial is 350450650 And Size Is 10.5
29 |
30 | console.log(`${TabletThree.fullDetails()}`);
31 | // LG Serial is 250450650 And Size Is Unknown
32 |
--------------------------------------------------------------------------------
/Week23/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week23/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | // Edit The Class
2 | class User {
3 | #c;
4 | constructor(username, card) {
5 | this.u = username;
6 | this.#c = card;
7 | }
8 | transform() {
9 | let credit = this.#c;
10 | credit = typeof credit == String ? credit : credit.toString();
11 | let creditRe = /\d{4}/g;
12 | let result = credit.match(creditRe);
13 | result = result.map(function (e, index) {
14 | return index < result.length - 1 ? e + "-" : e;
15 | });
16 | result = result.join("");
17 | return result;
18 | }
19 | get showData() {
20 | return `Hello ${this.u} Your credit Card Number Is ${this.transform()}`;
21 | }
22 | }
23 |
24 | // Do Not Edit Anything Below
25 |
26 | let userOne = new User("Osama", "1234-5678-1234-5678");
27 | let userTwo = new User("Ahmed", "1234567812345678");
28 | let userThree = new User("Ghareeb", 1234567812345678);
29 |
30 | console.log(userOne.showData);
31 | // Hello Osama Your Credit Card Number Is 1234-5678-1234-5678
32 |
33 | console.log(userTwo.showData);
34 | // Hello Ahmed Your Credit Card Number Is 1234-5678-1234-5678
35 |
36 | console.log(userThree.showData);
37 | // Hello Ghareeb Your Credit Card Number Is 1234-5678-1234-5678
38 |
39 | console.log(userOne.c); // Prevent Accessing To Card Property Here
40 | // Undefined
41 |
--------------------------------------------------------------------------------
/Week23/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week23/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | // Write Your Code Here
2 | String.prototype.addLove = function () {
3 | return `I Love ${myStr} Web School`;
4 | };
5 | // Do Not Edit Below
6 | let myStr = "Elzero";
7 | console.log(myStr.addLove()); // I Love Elzero Web School
8 |
--------------------------------------------------------------------------------
/Week23/Assignment5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week23/Assignment5/main.js:
--------------------------------------------------------------------------------
1 | const myObj = {
2 | username: "Elzero",
3 | id: 100,
4 | score: 1000,
5 | country: "Egypt",
6 | };
7 |
8 | Object.defineProperties(myObj, {
9 | id: { enumerable: false },
10 | score: { writable: false },
11 | });
12 | delete myObj.country;
13 |
14 | myObj.score = 500;
15 |
16 | for (let prop in myObj) {
17 | console.log(`${prop} => ${myObj[prop]}`);
18 | }
19 |
20 | console.log(myObj);
21 |
22 | // Needed Output
23 | /*
24 |
25 | "username => Elzero"
26 | "score => 1000"
27 | {username: 'Elzero', score: 1000, id: 100}
28 |
29 | */
30 |
--------------------------------------------------------------------------------
/Week24/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week24/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | let birthdate = new Date() - new Date("2002-02-02");
2 | console.log(`${Math.floor(birthdate / 1000)} Seconds`);
3 | console.log(`${Math.floor(birthdate / 1000 / 60)} Minutes`);
4 | console.log(`${Math.floor(birthdate / 1000 / 60 / 60)} Hours`);
5 | console.log(`${Math.floor(birthdate / 1000 / 60 / 60 / 24)} Days`);
6 | console.log(`${Math.floor(birthdate / 1000 / 60 / 60 / 24 / 30)} Months`);
7 | console.log(`${Math.floor(birthdate / 1000 / 60 / 60 / 24 / 365)} Years`);
8 |
--------------------------------------------------------------------------------
/Week24/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week24/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let dateAfter10Years = new Date(0);
2 | dateAfter10Years.setFullYear(1980);
3 | dateAfter10Years.setHours(0);
4 | dateAfter10Years.setSeconds(1);
5 | console.log(dateAfter10Years);
6 |
--------------------------------------------------------------------------------
/Week24/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week24/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | let dateNow = new Date();
2 | let dateLastMonth = new Date();
3 | dateLastMonth.setMonth(dateNow.getMonth() - 1);
4 | let m = dateLastMonth.getMonth();
5 | if (m == 0 || m == 2 || m == 4 || m == 6 || m == 7 || m == 9 || m == 11) {
6 | dateLastMonth.setDate(31);
7 | } else if (m == 3 || m == 5 || m == 8 || m == 10) {
8 | dateLastMonth.setDate(30);
9 | } else if (m == 1) {
10 | dateLastMonth.setDate(28);
11 | }
12 | let months = [
13 | "January",
14 | "February",
15 | "March",
16 | "April",
17 | "May",
18 | "June",
19 | "July",
20 | "August",
21 | "September",
22 | "October",
23 | "November",
24 | "December",
25 | ];
26 | console.log(dateLastMonth);
27 | console.log(
28 | `Previous Month Is ${
29 | months[dateLastMonth.getMonth()]
30 | } And Last Day Is ${dateLastMonth.getDate()}`
31 | );
32 |
--------------------------------------------------------------------------------
/Week24/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week24/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | let myBirthDate1 = new Date("02-02-2002");
2 | let myBirthDate2 = new Date(2002, 01, 02);
3 | let myBirthDate3 = new Date();
4 | myBirthDate3.setFullYear(2002, 1, 2);
5 | myBirthDate3.setHours(0, 0, 0, 0);
6 | console.log(myBirthDate1);
7 | console.log(myBirthDate2);
8 | console.log(myBirthDate3);
9 |
--------------------------------------------------------------------------------
/Week24/Assignment5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week24/Assignment5/main.js:
--------------------------------------------------------------------------------
1 | let start = performance.now();
2 | for (let i = 0; i < 99999; i++) {
3 | console.log(i);
4 | }
5 | let end = performance.now();
6 |
7 | console.log(`Loop Took ${Math.trunc(end - start)} Milliseconds.`);
8 |
--------------------------------------------------------------------------------
/Week24/Assignment6/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week24/Assignment6/main.js:
--------------------------------------------------------------------------------
1 | function* gen() {
2 | yield 14;
3 | yield 140 + 14;
4 | yield 140 + 14 + 340;
5 | let arr = [14, 140, 340];
6 | let sumArr;
7 | while (true) {
8 | arr.push(arr[arr.length - 1] + 200);
9 | sumArr = arr.reduce((a, b) => a + b);
10 | yield sumArr;
11 | }
12 | }
13 |
14 | let generator = gen();
15 |
16 | console.log(generator.next()); // {value: 14, done: false}
17 | console.log(generator.next()); // {value: 154, done: false}
18 | console.log(generator.next()); // {value: 494, done: false}
19 | console.log(generator.next()); // {value: 1034, done: false}
20 | console.log(generator.next()); // {value: 1774, done: false}
21 | console.log(generator.next()); // {value: 2714, done: false}
22 | console.log(generator.next()); // {value: 3854, done: false}
23 | console.log(generator.next()); // {value: 5194, done: false}
24 | console.log(generator.next()); // {value: 6734, done: false}
25 |
--------------------------------------------------------------------------------
/Week24/Assignment7/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week24/Assignment7/main.js:
--------------------------------------------------------------------------------
1 | function* genNumbers() {
2 | yield* [1, 2, 2, 2, 3, 4, 5];
3 | }
4 | function* genLetters() {
5 | yield* ["A", "B", "B", "B", "C", "D"];
6 | }
7 |
8 | function* genAll() {
9 | let numbers = genNumbers();
10 | numbers = [...new Set(numbers)];
11 | let letters = genLetters();
12 | letters = [...new Set(letters)];
13 | yield* numbers;
14 | yield* letters;
15 | }
16 | let generator = genAll();
17 |
18 | console.log(generator.next()); // {value: 1, done: false}
19 | console.log(generator.next()); // {value: 2, done: false}
20 | console.log(generator.next()); // {value: 3, done: false}
21 | console.log(generator.next()); // {value: 4, done: false}
22 | console.log(generator.next()); // {value: 5, done: false}
23 | console.log(generator.next()); // {value: "A", done: false}
24 | console.log(generator.next()); // {value: "B", done: false}
25 | console.log(generator.next()); // {value: "C", done: false}
26 | console.log(generator.next()); // {value: "D", done: false}
27 |
--------------------------------------------------------------------------------
/Week24/Assignment8/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Week24/Assignment8/main.js:
--------------------------------------------------------------------------------
1 | import calc, * as modOne from "./mod-one.js";
2 | console.log(calc(modOne.numOne, modOne.numTwo, modOne.numThree)); // 60
3 |
--------------------------------------------------------------------------------
/Week24/Assignment8/mod-one.js:
--------------------------------------------------------------------------------
1 | import { numOne, numTwo, numThree } from "./mod-two.js";
2 | export { numOne, numTwo, numThree };
3 | export default function (one, two, three) {
4 | return numOne + numTwo + numThree;
5 | }
6 |
--------------------------------------------------------------------------------
/Week24/Assignment8/mod-two.js:
--------------------------------------------------------------------------------
1 | let a = 10;
2 | let b = 20;
3 | let c = 30;
4 | export { a as numOne, b as numTwo, c as numThree };
5 |
--------------------------------------------------------------------------------
/Week25/Assignment1/articles.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 1,
4 | "author": "John Doe",
5 | "category": "JavaScript",
6 | "title": "JavaScript: The Good Parts",
7 | "description": "The good parts of JavaScript"
8 | },
9 | {
10 | "id": 2,
11 | "author": "Jane Doe",
12 | "category": "JavaScript",
13 | "title": "JavaScript: The Bad Parts",
14 | "description": "The bad parts of JavaScript"
15 | },
16 | {
17 | "id": 3,
18 | "author": "Robert Kowalski",
19 | "category": "Business",
20 | "title": "The rich father and the poor father",
21 | "description": "The rich father and the poor father"
22 | },
23 | {
24 | "id": 4,
25 | "author": "Al Sweigart",
26 | "category": "Python",
27 | "title": "Automate the Boring Stuff with Python",
28 | "description": "Automate the boring stuff with Python 'Practical Programming For Beginners'"
29 | },
30 | {
31 | "id": 5,
32 | "author": "Jaime Buelta",
33 | "category": "Python",
34 | "title": "Python Automation Cookbook:",
35 | "description": "Python Automation Cookbook: 75 Python automation ideas for web scraping, data wrangling, and processing Excel, reports, emails, and more, 2nd Edition"
36 | }
37 | ]
38 |
--------------------------------------------------------------------------------
/Week25/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week25/Assignment1/main.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalemoGPA/Learn-Js/0807ce25f6ed96f88ddc4bc443d5c4781300c205/Week25/Assignment1/main.js
--------------------------------------------------------------------------------
/Week25/Assignment2/articles.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 1,
4 | "author": "John Doe",
5 | "category": "JavaScript",
6 | "title": "JavaScript: The Good Parts",
7 | "description": "The good parts of JavaScript"
8 | },
9 | {
10 | "id": 2,
11 | "author": "Jane Doe",
12 | "category": "JavaScript",
13 | "title": "JavaScript: The Bad Parts",
14 | "description": "The bad parts of JavaScript"
15 | },
16 | {
17 | "id": 3,
18 | "author": "Robert Kowalski",
19 | "category": "Business",
20 | "title": "The rich father and the poor father",
21 | "description": "The rich father and the poor father"
22 | },
23 | {
24 | "id": 4,
25 | "author": "Al Sweigart",
26 | "category": "Python",
27 | "title": "Automate the Boring Stuff with Python",
28 | "description": "Automate the boring stuff with Python 'Practical Programming For Beginners'"
29 | },
30 | {
31 | "id": 5,
32 | "author": "Jaime Buelta",
33 | "category": "Python",
34 | "title": "Python Automation Cookbook:",
35 | "description": "Python Automation Cookbook: 75 Python automation ideas for web scraping, data wrangling, and processing Excel, reports, emails, and more, 2nd Edition"
36 | }
37 | ]
38 |
--------------------------------------------------------------------------------
/Week25/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week25/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let request = new XMLHttpRequest();
2 | request.open("GET", "./articles.json", true);
3 | request.send();
4 | request.onreadystatechange = function () {
5 | if (this.status == 200 && this.readyState == 4) {
6 | console.log(request.responseText);
7 | console.log("Data Loaded");
8 | }
9 | };
10 |
--------------------------------------------------------------------------------
/Week25/Assignment3/articles.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 1,
4 | "author": "John Doe",
5 | "category": "JavaScript",
6 | "title": "JavaScript: The Good Parts",
7 | "description": "The good parts of JavaScript"
8 | },
9 | {
10 | "id": 2,
11 | "author": "Jane Doe",
12 | "category": "JavaScript",
13 | "title": "JavaScript: The Bad Parts",
14 | "description": "The bad parts of JavaScript"
15 | },
16 | {
17 | "id": 3,
18 | "author": "Robert Kowalski",
19 | "category": "Business",
20 | "title": "The rich father and the poor father",
21 | "description": "The rich father and the poor father"
22 | },
23 | {
24 | "id": 4,
25 | "author": "Al Sweigart",
26 | "category": "Python",
27 | "title": "Automate the Boring Stuff with Python",
28 | "description": "Automate the boring stuff with Python 'Practical Programming For Beginners'"
29 | },
30 | {
31 | "id": 5,
32 | "author": "Jaime Buelta",
33 | "category": "Python",
34 | "title": "Python Automation Cookbook:",
35 | "description": "Python Automation Cookbook: 75 Python automation ideas for web scraping, data wrangling, and processing Excel, reports, emails, and more, 2nd Edition"
36 | }
37 | ]
38 |
--------------------------------------------------------------------------------
/Week25/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week25/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | let request = new XMLHttpRequest();
2 | request.open("GET", "./articles.json", true);
3 | request.send();
4 |
5 | request.onreadystatechange = function () {
6 | if (this.status == 200 && this.readyState == 4) {
7 | let mainData = JSON.parse(this.response);
8 | console.log(mainData);
9 | let updatedData = JSON.stringify(mainData);
10 | console.log(updatedData);
11 | }
12 | };
13 |
--------------------------------------------------------------------------------
/Week25/Assignment4/articles.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 1,
4 | "author": "John Doe",
5 | "category": "JavaScript",
6 | "title": "JavaScript: The Good Parts",
7 | "description": "The good parts of JavaScript"
8 | },
9 | {
10 | "id": 2,
11 | "author": "Jane Doe",
12 | "category": "JavaScript",
13 | "title": "JavaScript: The Bad Parts",
14 | "description": "The bad parts of JavaScript"
15 | },
16 | {
17 | "id": 3,
18 | "author": "Robert Kowalski",
19 | "category": "Business",
20 | "title": "The rich father and the poor father",
21 | "description": "The rich father and the poor father"
22 | },
23 | {
24 | "id": 4,
25 | "author": "Al Sweigart",
26 | "category": "Python",
27 | "title": "Automate the Boring Stuff with Python",
28 | "description": "Automate the boring stuff with Python 'Practical Programming For Beginners'"
29 | },
30 | {
31 | "id": 5,
32 | "author": "Jaime Buelta",
33 | "category": "Python",
34 | "title": "Python Automation Cookbook:",
35 | "description": "Python Automation Cookbook: 75 Python automation ideas for web scraping, data wrangling, and processing Excel, reports, emails, and more, 2nd Edition"
36 | }
37 | ]
38 |
--------------------------------------------------------------------------------
/Week25/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week25/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | let request = new XMLHttpRequest();
2 | request.open("GET", "./articles.json", true);
3 | request.send();
4 |
5 | request.onreadystatechange = function () {
6 | if (this.status == 200 && this.readyState == 4) {
7 | //
8 | let mainData = JSON.parse(this.response);
9 | console.log(mainData);
10 | let updatedData = JSON.stringify(mainData);
11 | console.log(updatedData);
12 | //
13 | let outerDiv = document.createElement("div");
14 | outerDiv.setAttribute("id", "data");
15 | for (let i = 0; i < mainData.length; i++) {
16 | let div = document.createElement("div");
17 | let h2 = document.createElement("h2");
18 | let h2Text = document.createTextNode(mainData[i].title);
19 | h2.append(h2Text);
20 | let p1 = document.createElement("p");
21 | let p1Text = document.createTextNode(mainData[i].description);
22 | p1.append(p1Text);
23 | let p2 = document.createElement("p");
24 | let p2Text = document.createTextNode(mainData[i].author);
25 | p2.append(p2Text);
26 | let p3 = document.createElement("p");
27 | let p3Text = document.createTextNode(mainData[i].category);
28 | p3.append(p3Text);
29 | div.append(h2, p1, p2, p3);
30 | outerDiv.append(div);
31 | }
32 | document.body.prepend(outerDiv);
33 | }
34 | };
35 |
--------------------------------------------------------------------------------
/Week26/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week26/Assignment1/jsonObject.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "userId": 10,
4 | "title": "Article Title Number 1",
5 | "description": "Article Description Number 1"
6 | },
7 | {
8 | "userId": 5,
9 | "title": "Article Title Number 2",
10 | "description": "Article Description Number 2"
11 | },
12 | {
13 | "userId": 5,
14 | "title": "Article Title Number 3",
15 | "description": "Article Description Number 3"
16 | },
17 | {
18 | "userId": 5,
19 | "title": "Article Title Number 4",
20 | "description": "Article Description Number 4"
21 | },
22 | {
23 | "userId": 5,
24 | "title": "Article Title Number 5",
25 | "description": "Article Description Number 5"
26 | },
27 | {
28 | "userId": 5,
29 | "title": "Article Title Number 6",
30 | "description": "Article Description Number 6"
31 | },
32 | {
33 | "userId": 25,
34 | "title": "Article Title Number 7",
35 | "description": "Article Description Number 7"
36 | },
37 | {
38 | "userId": 25,
39 | "title": "Article Title Number 8",
40 | "description": "Article Description Number 8"
41 | },
42 | {
43 | "userId": 15,
44 | "title": "Article Title Number 9",
45 | "description": "Article Description Number 9"
46 | },
47 | {
48 | "userId": 15,
49 | "title": "Article Title Number 10",
50 | "description": "Article Description Number 10"
51 | }
52 | ]
53 |
--------------------------------------------------------------------------------
/Week26/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | let myPromise = new Promise((res, rej) => {
2 | let request = new XMLHttpRequest();
3 | request.open("GET", "./jsonObject.json");
4 | request.send();
5 | request.onload = function () {
6 | if (this.readyState === 4 && this.status === 200) {
7 | res(request.response);
8 | } else {
9 | rej(Error("Not Found"));
10 | }
11 | };
12 | })
13 | .then((result) => {
14 | let myData = JSON.parse(result);
15 | myData.length = 5;
16 | return myData;
17 | })
18 | .then((result) => {
19 | for (let i = 0; i < result.length; i++) {
20 | let div = document.createElement("div");
21 | let h3 = document.createElement("h3");
22 | let p = document.createElement("p");
23 | let h3Text = document.createTextNode(result[i].title);
24 | let pText = document.createTextNode(result[i].description);
25 | p.append(pText);
26 | h3.append(h3Text);
27 | div.append(h3, p);
28 | document.body.append(div);
29 | }
30 | });
31 |
--------------------------------------------------------------------------------
/Week26/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Week26/Assignment2/jsonObject.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "userId": 10,
4 | "title": "Article Title Number 1",
5 | "description": "Article Description Number 1"
6 | },
7 | {
8 | "userId": 5,
9 | "title": "Article Title Number 2",
10 | "description": "Article Description Number 2"
11 | },
12 | {
13 | "userId": 5,
14 | "title": "Article Title Number 3",
15 | "description": "Article Description Number 3"
16 | },
17 | {
18 | "userId": 5,
19 | "title": "Article Title Number 4",
20 | "description": "Article Description Number 4"
21 | },
22 | {
23 | "userId": 5,
24 | "title": "Article Title Number 5",
25 | "description": "Article Description Number 5"
26 | },
27 | {
28 | "userId": 5,
29 | "title": "Article Title Number 6",
30 | "description": "Article Description Number 6"
31 | },
32 | {
33 | "userId": 25,
34 | "title": "Article Title Number 7",
35 | "description": "Article Description Number 7"
36 | },
37 | {
38 | "userId": 25,
39 | "title": "Article Title Number 8",
40 | "description": "Article Description Number 8"
41 | },
42 | {
43 | "userId": 15,
44 | "title": "Article Title Number 9",
45 | "description": "Article Description Number 9"
46 | },
47 | {
48 | "userId": 15,
49 | "title": "Article Title Number 10",
50 | "description": "Article Description Number 10"
51 | }
52 | ]
53 |
--------------------------------------------------------------------------------
/Week26/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let myData = fetch("./jsonObject.json");
2 | myData
3 | .then((result) => {
4 | let data = result.json();
5 | return data;
6 | })
7 | .then((result) => {
8 | result.length = 5;
9 | return result;
10 | })
11 | .then((result) => {
12 | for (let i = 0; i < result.length; i++) {
13 | let div = document.createElement("div");
14 | let h3 = document.createElement("h3");
15 | let p = document.createElement("p");
16 | let h3Text = document.createTextNode(result[i].title);
17 | let pText = document.createTextNode(result[i].description);
18 | p.append(pText);
19 | h3.append(h3Text);
20 | div.append(h3, p);
21 | document.body.append(div);
22 | }
23 | });
24 |
--------------------------------------------------------------------------------
/Week3/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Week3/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | console.log(10 * 20 * 15 * 3 * 190 % 10 * 400);
2 |
--------------------------------------------------------------------------------
/Week3/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Week3/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let num = 3;
2 |
3 | // Solution One
4 | console.log(num + num); // 6
5 |
6 | // Solution Two
7 | console.log(num + +`${num}`); // 6
8 |
9 | // Soultion Three
10 | console.log(num - `${-num}`); // 6
11 |
12 | // Soultion Four
13 | console.log(num + true + true + true); // 6
14 |
15 | // Solution Five
16 | console.log(-num++ + ++num + --num); // 6
17 |
18 | // Solution Six
19 | console.log((num * num * num * num) % (++num + num++)); // 6
20 |
--------------------------------------------------------------------------------
/Week3/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Week3/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | let num = "10";
2 |
3 | // Solution One
4 | console.log(+num + +num); // 20
5 |
6 | // Solution Two
7 | console.log(Number(num) + Number(num)); // 20
8 |
9 | // Solution Three
10 | console.log(num - -num); // 20
11 |
12 | // Solution Four
13 | console.log((num * num) / (num >> true)); // 20
14 |
--------------------------------------------------------------------------------
/Week4/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Week4/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | console.log(100_000); // 100000
2 | console.log(100000); // 100000
3 | console.log(5e4 + 5e4); // 100000
4 |
5 | // Your Solutions
6 | console.log(Number("1000000")); // 100000
7 | console.log(Math.pow(10, 6)); // 100000
8 | console.log(10 ** 6); // 100000
9 | console.log(Math.sqrt(1e12)); // 100000
10 | console.log(Math.floor(1e6 + 0.5)); // 100000
11 | console.log(Math.ceil(1e6 - 0.5)); // 100000
12 | console.log(Math.round(1e6 + 0.2)); // 100000
13 | console.log(Number.parseInt("1000000 Ali")); // 100000
14 | console.log(+"1000000.0000"); // 100000
15 | console.log(Math.abs(-"1000000")); // 100000
16 |
--------------------------------------------------------------------------------
/Week4/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Week4/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | console.log(-Number.MIN_SAFE_INTEGER);
2 |
--------------------------------------------------------------------------------
/Week4/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Week4/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | console.log(Math.round(Math.log10(Number.MAX_SAFE_INTEGER)));
2 |
--------------------------------------------------------------------------------
/Week4/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Week4/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | let myVar = "100.56789 Views";
2 |
3 | console.log(Number.parseInt(myVar)); // 100
4 | console.log(Number.parseFloat(Number.parseFloat(myVar).toFixed(2))); // 100.57
5 |
--------------------------------------------------------------------------------
/Week4/Assignment5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Week4/Assignment5/main.js:
--------------------------------------------------------------------------------
1 | let num = 10;
2 |
3 | console.log(Number.isInteger(num) + Number.isInteger(num)); // 2
4 |
--------------------------------------------------------------------------------
/Week4/Assignment6/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Week4/Assignment6/main.js:
--------------------------------------------------------------------------------
1 | let flt = 10.4;
2 |
3 | console.log(Math.floor(flt)); // 10
4 | console.log(Math.ceil(Math.trunc(flt))); // 10
5 | console.log(Math.trunc(flt)); // 10
6 | console.log(Math.round(flt)); // 10
7 | console.log(Number.parseInt(flt)); // 10
8 |
--------------------------------------------------------------------------------
/Week4/Assignment7/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Week4/Assignment7/main.js:
--------------------------------------------------------------------------------
1 | console.log(Number.parseInt(Math.random() * 5));
2 |
--------------------------------------------------------------------------------
/Week5/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week5/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | let userName = "Elzero";
2 | console.log(userName.split("")[0].toLowerCase()); // e
3 | console.log(userName.slice(0, 1).toLowerCase()); // e
4 | console.log(userName.substring(0, 1).toLowerCase()); // e
5 | console.log(userName.substr(0, 1).toLowerCase()); // e
6 | console.log(userName.charAt(0).toLowerCase()); // e
7 | console.log(userName[0].toLowerCase().repeat(3)); // eee
8 |
--------------------------------------------------------------------------------
/Week5/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week5/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let word = "Elzero";
2 | let letterZ = "z";
3 | let letterE = "e";
4 | let letterO = "O";
5 |
6 | console.log(word.includes(letterZ)); // True
7 | console.log(word.toLowerCase().startsWith(letterE.toLowerCase())); // True
8 | console.log(word.toLowerCase().endsWith(letterO.toLowerCase())); // True
9 |
--------------------------------------------------------------------------------
/Week6/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week6/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | console.log(100 == "100"); // true
2 | console.log(100 < 1000); // true
3 | console.log(110 > 100 && 10 < 20); // true
4 | console.log(-10 == "-10"); // true
5 | console.log(typeof -50 === typeof +"-40"); // true
6 | console.log(typeof 10 == typeof -"-40"); // true
7 | console.log(typeof "10" != typeof 10); // true
8 | console.log(!20 == false); // true
9 |
--------------------------------------------------------------------------------
/Week6/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week6/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let num1 = 10;
2 | let num2 = 20;
3 |
4 | console.log(num1 < num2); // true
5 | console.log(typeof num1 === typeof num2); // true
6 | console.log(num1 <= num2); // true
7 | console.log(num1 != num2); // true
8 | console.log(num1 !== num2); // true
9 | console.log(!(num1 > num2)); // true
10 |
--------------------------------------------------------------------------------
/Week6/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week6/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | let a = 20;
2 | let b = 30;
3 | let c = 10;
4 |
5 | console.log((a < b && a < c) || a < b); // true
6 | console.log(a < b || a > c); // true
7 | console.log(!(a > b) && !(a > b) && !(a < c) && !(a < c)); // true
8 |
--------------------------------------------------------------------------------
/Week7/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week7/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | // case 1 : let num = 9; // "009"
2 | // case 2 : let num = 20; // "020"
3 | // case 3 : let num = 110; // "110"
4 | if (num < 10) {
5 | console.log("00" + num);
6 | } else if (num < 100 && num >= 10) {
7 | console.log("0" + num);
8 | } else if (num >= 100) {
9 | console.log(num);
10 | }
11 |
--------------------------------------------------------------------------------
/Week7/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week7/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let num1 = 9;
2 | let str = "9";
3 | let str2 = "20";
4 | if (num1 == str) {
5 | console.log("{num1} Is The Same Value As {str}");
6 | }
7 | if (num1 == str && typeof num1 != typeof str) {
8 | console.log("{num1} Is The Same Value As {str} But Not The Same Type");
9 | }
10 | if (num1 != str2 && typeof num1 != typeof str2) {
11 | console.log("{num1} Is Not The Same Value Or The Same Type As {str2}");
12 | }
13 | if (str != str2 && typeof str == typeof str2) {
14 | console.log("{str} Is The Same Type As {str2} But Not The Same Value");
15 | }
16 |
--------------------------------------------------------------------------------
/Week7/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week7/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | let num1 = 10;
2 | let num2 = 30;
3 | let num3 = "30";
4 | if (num3 > num1 && typeof num3 != typeof num2) {
5 | console.log(
6 | "30 Is Larger Than 10 And Type string Not The Same Type As number"
7 | );
8 | if (num3 > num1 && num3 == num2 && typeof num3 != typeof num2) {
9 | console.log(
10 | "30 Is Larger Than 10 And Value Is The Same As 30 And Type string Not The Same Type As number"
11 | );
12 | if (
13 | num3 != num1 &&
14 | typeof num3 != typeof num1 &&
15 | typeof num3 != typeof num2
16 | ) {
17 | console.log(
18 | "{num3} Value And Type Is Not The Same As {num1} And Type Is Not The Same As {num2}"
19 | );
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Week7/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week7/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | // Edit What You Want Here
2 |
3 | let num1 = 15;
4 | let num2 = 10;
5 | let num3 = 15;
6 | let num4 = 41;
7 |
8 | /*
9 | Do Not Edit Below This Line
10 | Needed Output
11 | True 7 Times
12 | */
13 |
14 | // Condition 1
15 |
16 | if (num1 > num2) {
17 | console.log("True");
18 | } else {
19 | console.log("False");
20 | }
21 |
22 | // Condition 2
23 |
24 | if (num1 > num2 && num1 < num4) {
25 | console.log("True");
26 | } else {
27 | console.log("False");
28 | }
29 |
30 | // Condition 3
31 |
32 | if (num1 > num2 && num1 === num3) {
33 | console.log("True");
34 | } else {
35 | console.log("False");
36 | }
37 |
38 | // Condition 4
39 |
40 | if (num1 + num2 < num4) {
41 | console.log("True");
42 | } else {
43 | console.log("False");
44 | }
45 |
46 | // Condition 5
47 |
48 | if (num1 + num3 < num4) {
49 | console.log("True");
50 | } else {
51 | console.log("False");
52 | }
53 |
54 | // Condition 6
55 |
56 | if (num1 + num2 + num3 < num4) {
57 | console.log("True");
58 | } else {
59 | console.log("False");
60 | }
61 |
62 | // Condition 7
63 |
64 | if (num4 - (num1 + num3) + num2 === 21) {
65 | console.log("True");
66 | } else {
67 | console.log("False");
68 | }
69 |
--------------------------------------------------------------------------------
/Week8/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week8/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | let day = " monday ";
2 | // // You Need To Remove Spaces And Make First Letter Capital => Friday
3 |
4 | // let day = "Friday";
5 | // let day = "Saturday";
6 | // let day = "Sunday";
7 | // // Output => "No Appointments Available"
8 |
9 | // let day = "Monday";
10 | // let day = "Thursday";
11 | // // Output => "From 10:00 AM To 5:00 PM"
12 |
13 | // let day = "Tuesday";
14 | // // Output => "From 10:00 AM To 6:00 PM"
15 |
16 | // let day = "Wednesday";
17 | // // Output => "From 10:00 AM To 7:00 PM"
18 |
19 | // let day = "World";
20 | // // Output => "Its Not A Valid Day"
21 | day = day.trim();
22 | day = day.charAt(0).toUpperCase() + day.slice(1);
23 | console.log(day);
24 | switch (day) {
25 | case "Friday":
26 | case "Saturday":
27 | case "Sunday":
28 | console.log("No Appointments Available");
29 | break;
30 | case "Monday":
31 | case "Thursday":
32 | console.log("From 10:00 AM To 5:00 PM");
33 | break;
34 | case "Tuesday":
35 | console.log("From 10:00 AM To 6:00 PM");
36 | break;
37 | case "Wednesday":
38 | console.log("From 10:00 AM To 7:00 PM");
39 | break;
40 | default:
41 | console.log("Its Not A Valid Day");
42 | }
43 |
--------------------------------------------------------------------------------
/Week9/Assignment1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week9/Assignment1/main.js:
--------------------------------------------------------------------------------
1 | let myFriends = ["Ahmed", "Elham", "Osama", "Gamal"];
2 | let num = 3;
3 | let myFriends2 = myFriends;
4 | myFriends2.pop();
5 | // Method 1
6 | console.log(myFriends2); // ["Ahmed", "Elham", "Osama"];
7 |
8 | // Method 2
9 | console.log(myFriends.splice(false, num)); // ["Ahmed", "Elham", "Osama"];
10 |
--------------------------------------------------------------------------------
/Week9/Assignment2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week9/Assignment2/main.js:
--------------------------------------------------------------------------------
1 | let friends = ["Ahmed", "Eman", "Osama", "Gamal"];
2 |
3 | friends.pop();
4 | friends.shift();
5 |
6 | console.log(friends); // ["Eman", "Osama"]
7 |
--------------------------------------------------------------------------------
/Week9/Assignment3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week9/Assignment3/main.js:
--------------------------------------------------------------------------------
1 | let arrOne = ["C", "D", "X"];
2 | let arrTwo = ["A", "B", "Z"];
3 | let finalArr = [];
4 |
5 | finalArr = arrOne.concat(arrTwo).sort().reverse();
6 |
7 | console.log(finalArr); // ["Z", "X", "D", "C", "B", "A"]
8 |
--------------------------------------------------------------------------------
/Week9/Assignment4/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week9/Assignment4/main.js:
--------------------------------------------------------------------------------
1 | let website = "Go";
2 | let words = [`${website}ogle`, "Facebook", ["Elzero", "Web", "School"]];
3 |
4 | console.log(
5 | words
6 | .reverse()[0][0]
7 | .slice(website.length, website.length + words.length + true)
8 | .toUpperCase()
9 | ); // ZERO
10 |
--------------------------------------------------------------------------------
/Week9/Assignment5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week9/Assignment5/main.js:
--------------------------------------------------------------------------------
1 | let needle = "JS";
2 | let haystack = ["PHP", "JS", "Python"];
3 |
4 | let res = haystack.includes(needle);
5 | if (res) {
6 | console.log("Found");
7 | }
8 |
9 | let res1 = haystack.indexOf(needle);
10 | if (res1 != -1) {
11 | console.log("Found");
12 | }
13 | let res2 = haystack.lastIndexOf(needle);
14 | if (res2 != -1) {
15 | console.log("Found");
16 | }
17 |
--------------------------------------------------------------------------------
/Week9/Assignment6/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Week9/Assignment6/main.js:
--------------------------------------------------------------------------------
1 | let arr1 = ["A", "C", "X"];
2 | let arr2 = ["D", "E", "F", "Y"];
3 | let allArrs = [];
4 |
5 | allArrs = arr1
6 | .concat(arr2)
7 | .sort()
8 | .splice(arr2.length, arr1.length)
9 | .join("")
10 | .toLowerCase();
11 |
12 | console.log(allArrs); // fxy
13 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | // import elzero, { myNum, arr, saySomething as s } from "./main.js";
2 |
3 | // console.log(myNum);
4 | // console.log(arr);
5 | // console.log(s());
6 | // console.log(elzero());
7 |
8 | import * as all from "./main.js";
9 |
10 | console.log(all);
11 | console.log(all.myNum);
12 | console.log(all.saySomething());
13 | console.log(all.arr);
14 |
--------------------------------------------------------------------------------
/desktop.ini:
--------------------------------------------------------------------------------
1 | [.ShellClassInfo]
2 | IconResource=D:\Google Downloads\javascript.ico,0
3 | [ViewState]
4 | Mode=
5 | Vid=
6 | FolderType=Generic
7 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/main.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalemoGPA/Learn-Js/0807ce25f6ed96f88ddc4bc443d5c4781300c205/main.css
--------------------------------------------------------------------------------
/main.js:
--------------------------------------------------------------------------------
1 | const myPromise = new Promise((res, rej) => {
2 | setTimeout(() => {
3 | res("I am the good promise");
4 | }, 3000);
5 | });
6 |
7 | async function fetchData() {
8 | console.log("Before Fetch");
9 | try {
10 | let myData = await fetch("https://api.github.com/users/HalemoGPA/repos");
11 | console.log(await myData.json());
12 | } catch (reason) {
13 | console.log(reason);
14 | } finally {
15 | console.log("After Fetch");
16 | }
17 | }
18 |
19 | fetchData();
20 |
--------------------------------------------------------------------------------
/test.json:
--------------------------------------------------------------------------------
1 | {
2 | "string": "Elzero",
3 | "number": 100,
4 | "object": { "EG": "cairo", "US": "New York" },
5 | "array": ["HTML", "CSS", "JS"],
6 | "boolean": true,
7 | "null": null
8 | }
9 |
--------------------------------------------------------------------------------
/test.xml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalemoGPA/Learn-Js/0807ce25f6ed96f88ddc4bc443d5c4781300c205/test.xml
--------------------------------------------------------------------------------