|
4 | 4 | Comments
|
5 | 5 | ========
|
6 | 6 |
|
7 |
| - Let's start with comments. Comments are notes that people can read and |
8 |
| - computers will ignore. |
| 7 | + Let's start with comments. This is a comment. Comments are notes that people |
| 8 | + can read and computers will ignore. |
9 | 9 |
|
10 | 10 | They will help us to guide you through the JavaScript introduction
|
11 | 11 | journey.
|
12 | 12 | */
|
13 | 13 |
|
| 14 | +// Single line comments look like this. |
| 15 | + |
14 | 16 | /*
|
15 | 17 | Multi-line comments look like this.
|
| 18 | + When you are writing actual code, put it outside these comment blocks, |
| 19 | + so the computer doesn't ignore them. |
16 | 20 | */
|
17 | 21 |
|
18 |
| -// Single line comments look like this. |
19 |
| - |
20 |
| - |
21 | 22 | /*
|
22 | 23 | Let's start with getting your code on the screen.
|
23 | 24 |
|
24 | 25 | There are a few ways you can do it and we will look into a few of them:
|
25 | 26 |
|
26 |
| - * alert('Hello girls!'); |
| 27 | + alert('Hello girls!'); |
27 | 28 | ** This line of code will pop-up a small window in your browser with the text
|
28 | 29 | 'Hello girls!' in it, but you need to refresh the opened page first.
|
29 | 30 |
|
30 |
| - * console.log('Hello World!'); |
| 31 | + console.log('Hello World!'); |
31 | 32 | ** This line of code will print 'Hello World!' to the browser's console.
|
32 | 33 |
|
33 | 34 | P.S: To see the browser's console you can right click on the window of your
|
34 |
| - browser(Chrome, Firefox etc) and select 'Inspect' or 'Inspect element'. |
| 35 | + browser (Chrome, Firefox etc) and select 'Inspect' or 'Inspect element'. |
35 | 36 | After that a console will appear on the bottom right side of the page.
|
36 | 37 | */
|
37 | 38 |
|
|
75 | 76 | As you can notice, we can give different types of values to our variables -
|
76 | 77 | strings, numbers, booleans etc.
|
77 | 78 |
|
78 |
| - A string is a set of characters, word(s) or phrase(s) that we wrap in quotes, |
79 |
| - see 'hello world!' in the previous task. |
80 |
| - Numbers - either integers or floats(decimals) |
| 79 | +
|
| 80 | + Strings - set of characters, word(s), or phrases that we wrap in quotes, like |
| 81 | + 'hello world!' |
| 82 | + Numbers - either integers or floats(decimals). Not wrapped in quotes |
81 | 83 | Boolean - it represents logical values - True or False
|
82 | 84 | */
|
83 | 85 |
|
|
123 | 125 | alert(sumOfNumbers);
|
124 | 126 |
|
125 | 127 | This will pop-up an alert box with the number 4.
|
126 |
| -
|
127 |
| - (You can see a full list of ) |
| 128 | + TIP: Note how we didn't put 1 and 3 in quotes, because they are numbers. |
128 | 129 | */
|
129 | 130 |
|
130 | 131 | // TODO: Create 3 variables:
|
|
143 | 144 | Functions
|
144 | 145 | =========
|
145 | 146 |
|
146 |
| - A function is a reusable piece of code, an action that you want to do. |
147 |
| - It takes some input (arguments), does some manipulation on it and returns |
148 |
| - the output. Use the keyword 'return' to define the return value. |
| 147 | + A function is like a blueprint, an action that you want to do. |
| 148 | + It takes some input variables called arguments, does some manipulation on |
| 149 | + it and returns the output. Use the keyword 'return' to define the return value. |
149 | 150 |
|
150 | 151 | To create a function use the following format:
|
151 | 152 |
|
|
303 | 304 |
|
304 | 305 |
|
305 | 306 | ///////////////////////////////////////////////////////////////////////////
|
306 |
| -//Congratulations! You have finished Part 1 of JavaScript Basics! // |
| 307 | +// Congratulations! You have finished Part 1 of JavaScript Basics! // |
307 | 308 | // Stand up, stretch your legs, and celebrate your achievement. //
|
308 |
| -//The next step will be following the instructions in the level2.js file.// |
| 309 | +// The next step will be following the instructions in the level2.js file// |
309 | 310 | ///////////////////////////////////////////////////////////////////////////
|
0 commit comments