8000 Improvment suggestions after august workshop (#37) · muses-code-js/js-intro-workshop@9886711 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9886711

Browse files
tammButenkoT
authored andcommitted
Improvment suggestions after august workshop (#37)
* Some updates to the instructions, a lot is just markup. * Suggestions to improve level1.js * A few more details to level1.js * Suggestions to improve level2.js * Suggestions to improve level3.js
1 parent 46bfd20 commit 9886711

File tree

7 files changed

+335
-262
lines changed

7 files changed

+335
-262
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
.idea/
2-
.vscode/launch.json
2+
.vscode/launch.json
3+
# Mac related system files
4+
.DS_Store

README.md

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,60 @@ An introductory JavaScript workshop for beginners.
66

77
Check on slides, click [here](https://goo.gl/5HNvxD)
88

9-
109
## Feedback
1110

1211
To leave feedback click [here](https://docs.google.com/forms/d/e/1FAIpQLSdoOaviRIqsDPi1ZPTvTDVEzeQrSiEoDhsS0tmAIQZmkLkvxw/viewform?c=0&w=1)
1312

14-
1513
## How to use
1614

17-
If you are familiar with git, you can clone this repository to your machine and simply start working
18-
through files starting from README.md file, after that jump to js/level1.js file.
15+
If you are familiar with git, you can clone this repository to your machine.
1916

17+
If you don't know what git is, relax. You can easily download the folder on your machine - go to
18+
the 'releases' tab over the yellow line on the page and click the link 'Source code (zip)'.
19+
Unzip it (Extract) and open the folder, don't open files inside the .zip.
2020

21-
If you don't know what git is, relax. You can download the folder on your machine - go to
22-
'releases' tab over the yellow line on the page and download folder 'Source code (zip)'.
23-
Unzip it and start from README.md file, after jumping to js/level1.js file.
21+
Start from the `README.md` file, then open `js/level1.js`.
2422

23+
To see the web-page in your browser, open `index.html` by double clicking on it, if you see
24+
an option 'open in browser' then choose that. Preferably use Chrome, but Firefox and Safari will work as well.
2525

26-
To open the web-page in your browser go to _index.html_ file and double click on it, you will see
27-
an option 'open in browser'. Preferably use Chrome, but Firefox and Safari will work as well.
26+
Follow the instructions in `js/level1.js` and type code in your Text Editor (this is where your code lives and you can write, edit and delete code).
2827

29-
Follow the instructions in _level1.js_ file and type code in your Text Editor (it is where your code lives and you can write, edit and delete code). In order to see anything that you console.log(), you need refresh the web page and the result will be in web console on the page (you can directly write javaScript code here as well and see the result straight away, but as soon as you refresh the page all the code will be gone, that is why we use Text Editor).
28+
In order to see anything that you edit, you need to save the file and refresh the web page. The result of any console.log() statement will be in the _browser console_.
3029

30+
### How to open the `Browser Console`
31+
| Browser | Platform | Instruction |
32+
| ----------- | -------- | --------------------------------------------------- |
33+
| **Chrome** | Any | right-click the page and select `Inspect`, switch to `Console` tab in the developer tools |
34+
| **Chrome** | Mac | press `COMMAND + OPTION + J` |
35+
| **Chrome** | Windows | press `CONTROL + SHIFT + J` |
36+
| **Firefox** | Any | right-click the page and select `Inspect Element`, switch to `Console` tab |
37+
| **Firefox** | Mac | press `COMMAND + OPTION + K` |
38+
| **Firefox** | Windows | press `CONTROL + SHIFT + K` |
39+
| **Safari** | Mac | go to the menu bar and open `Safari > Preferences > Advanced >` and tick the box `Show Develop Menu` at the bottom, restart Safari, now you can right-click on the page and select `Inspect Element` to see the console. |
40+
| **Safari** | Mac | press `COMMAND + OPTION + C` |
3141

42+
The console/developer tools will appear at the bottom or on the right side of the screen.
43+
44+
You can write JavaScript code directly here and see the result straight away, but as soon as you refresh the page all the code will be gone, this is why we use a Text Editor in order to save our code.
3245

3346
## Structure
3447

35-
- CSS folder - contains css files that are responsible for styles and how our project looks on the web.
48+
- `css` folder - contains css files that are responsible for styles and how our project looks on the web.
3649

37-
- img folder - a place where we can store images that we will use on our web-page.
50+
- `img` folder - a place where we can store images that we will use on our web-page.
3851

39-
- Js folder contains javaScript files that makes our project work, it defines content and makes a static page functional.
52+
- `js` folder contains JavaScript files that makes our project work, it defines content and makes a static page functional.
4053
It contains 3 files:
41-
- _level1.js_ - basics with explanations(comments, variables, functions, if/else statements)
42-
- _level2.js_ - more complex javaScript with explanations(arrays, loops)
43-
- _level3.js_ - html, css and how manipulate them with javaScript (selectors)
44-
45-
- _index.html_ - a file responsible for the structure of our project
54+
- `level1.js` - basics with explanations (comments, variables, functions, if/else statements)
55+
- `level2.js` - more complex JavaScript with explanations (arrays, loops)
56+
- `level3.js` - html, css and how manipulate them with JavaScript (selectors)
4657

47-
- _Readme.md_ - a file with explanations and any information about the project, how to run it, what it is for etc
58+
- `index.html` - a file responsible for the structure of our project
4859

49-
- _cheat-sheet.md_ - a file with a qui 1E79 ck overlook for key namings and their explanations
60+
- `Readme.md` - a file with explanations and any information about the project, how to run it, what it is for etc
5061

62+
- `cheat-sheet.md` - a file with a quick overlook for key namings and their explanations
5163

5264
## Author
5365
Tanya Butenko

cheat-sheet.md

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,28 @@
11
# JavaScript Cheatsheet
22

3-
43
## JavaScript (or JS)
54

6-
It is a popular programming language commonly used to create interactive effects within web browsers.
7-
5+
A popular programming language commonly used to create interactive effects within web browsers.
86

97
## variable
108

119
A place to store values, can store any kind of information (data types): numbers, words, collections of data
1210

13-
1411
### undefined variable
1512

1613
A variable that has no value
1714

1815
### to declare variable
1916

20-
To create a variable - done by using:
17+
To create a variable - done by using:
2118

2219
```
2320
let variableName = value;
2421
```
2522

26-
2723
### to initialize variable
2824

29-
Set (give) some value to variable.
25+
Set (give) some value to a variable.
3026

3127
## value types
3228

@@ -42,27 +38,23 @@ Boolean variable represent a logical value True or False
4238

4339
An ordered list of values, can store different types of data inside
4440

45-
4641
### operator
4742

4843
Mathematical operators, such as: +, -, *, /, >, <, = etc
4944

50-
5145
## comments
5246

53-
Comments are some notes that you can leave for yourself or another person, a note that a computer will not read. You can write a comment on a new line or on the same line after code as so:
47+
Comments are notes that you can leave for yourself or another person, a note that a computer will not read. You can write a comment on a new line or on the same line after code as so:
5448

5549
```
56-
// I’m your comment
50+
let variableName; // I’m your comment
5751
```
58-
Single line comment starts with `//`
59-
Multi line comment are placed between `/* .. */`
60-
52+
Single line comments start with `//` and continue for the entire line
53+
Multi line comments are placed between `/* .. */` and can end at any point on a line
6154

6255
## function
6356

64-
A separable, reusable piece of code. It takes some input, does some manipulation on it and returns us an output.
65-
57+
A separable, reusable piece of code. It takes some input, does some manipulation on it and returns an output.
6658

6759
### to declare function
6860

@@ -72,19 +64,18 @@ To create a function
7264

7365
A value input that functions can accept
7466

75-
7667
## if/else statement
7768

78-
`if` used to decide which lines of code to execute, `else` - to give alternative set of instructions.
69+
`if` is used to decide if lines of code should be executed, `else` - gives an alternative set of instructions.
7970

80-
Example:
71+
Example:
8172

8273
```
8374
if (x > 5) {
8475
console.log("X bigger than 5");
8576
}
8677
else {
87-
console.log("X smaller than 5");
78+
console.log("X smaller than or equal to 5");
8879
}
8980
```
9081

@@ -94,53 +85,46 @@ else {
9485

9586
It repeats code over and over again until some condition is met.
9687

97-
9888
### for loop
9989

100-
This loop is similar to ‘while loop’, just with a set amount of repetition. You declare counter in the statement as so:
90+
This loop is similar to ‘while loop’, just with a set amount of repetition. You declare counter in the statement as so:
10191

10292
```
10393
for (let i = 0; i < 5; i++) {
10494
do something 5 times
10595
}
10696
```
10797

108-
10998
### infinite loop
11099

111-
A loop that does not stop and it’s a loop that you need to avoid. Each loop should have some condition so it can stop.
100+
This is an error which means that a loop does not stop.
112101

102+
In order to avoid this error each loop should have some condition so it can stop, and contain some way to trigger the condition.
113103

114104
## object
115105

116106
A collection of properties
117107

118-
119108
## event
120109

121110
A type of object that is created when a user interacts with a web page. For example, JavaScript creates an event when a user clicks on a button.
122111

123-
124112
## CSS
125113

126114
Stands for Cascading Style Sheets. CSS describes how HTML elements are to be displayed on screen. It is presentation.
127115

128-
129116
## HTML
130117

131118
Stands for Hyper Text Markup Language. It is a structure of the elements on the page.
132119

133-
134120
## DOM
135121

136122
Stands for Document Object Model. It defines the logical structure of documents and the way a document is accessed and manipulated.
137123

138-
139124
## scope
140125

141126
Scope is the set of variables, objects, and functions that you can access.
142127

143-
144128
## console
145129

146-
A method of interacting with the system. In order to write to the browser console, you could use console.log(‘Hello World’). This would write Hello World in the browser console.
130+
A method of interacting with the system. In order to write to the browser console, you could use console.log(‘Hello World’). This would write Hello World in the browser console.

index.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ <h2>Let's do some interactive coding today!</h2>
2121
<main>
2222
<div>
2323
<p>On <a href="https://www.google.com/chrome/browser/desktop/index.html">Chrome</a> and <a href="https://www.mozilla.org/en-GB/firefox/new/">Firefox</a>,
24-
to open the Browser Console, invoke the context/right click menu and select <i>'Inspect'</i>. The console will
24+
93C6 to open the <i>Browser Console</i>, right-click the page and select <i>'Inspect'</i>. The console will
2525
appear at the bottom or on the right side of the screen.</p>
2626
<p>If you're ready for a shortcut, press <i>'<abbr title="Command">CMD</abbr>+<abbr title="Option">OPT</abbr>+J'</i>
2727
on Mac, or <i>'F12'</i> on Windows</p>
28-
<p>On <a href="https://support.apple.com/en-au/HT204416">Safari</a>, go to <i>'Safari > Preferences > Advanced >'</i>
29-
and tick the box Show Develop Menu in menu bar, restart Safari, and now you can double click on the page and
28+
<p>On <a href="https://support.apple.com/en-au/HT204416">Safari</a>, go to the menu bar and open <i>'Safari > Preferences > Advanced >'</i>
29+
and tick the box <i>'Show Develop Menu'</i>, restart Safari, now you can right-click on the page and
3030
select <i>'Inspect Element'</i> to see the console.</p>
3131
</div>
3232
</main>
33+
3334
<footer>
3435
<div>
3536
<ul>
@@ -55,7 +56,7 @@ <h2>Let's do some interactive coding today!</h2>
5556
</ul>
5657
</div>
5758
</footer>
59+
5860
<script src="js/level1.js"></script>
5961
</body>
60-
6162
</html>

0 commit comments

Comments
 (0)
0