Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5385798

Browse files
author
Noer Paanakker
committed
added content hw week 1
1 parent 38fa0b3 commit 5385798

File tree

5 files changed

+214
-53
lines changed

5 files changed

+214
-53
lines changed

README.md

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,48 @@
77

88
![JavaScript1](./assets/javascript1.png)
99

10-
In this module you'll make a start into wonderful world of programming. We will be using the programming language `JavaScript` to do this. You'll learn about the basic buildings of programming: loops, functions, control flow and more. Consider these as the ABC's of programming, without them it's impossible to write working software!
10+
In this module you'll make a start into wonderful world of programming. We will be using the programming language `JavaScript` to do this. You'll learn about the basic buildings of programming: `loops, functions, control flow and more. Consider these as the ABC's of programming, without them it's impossible to write working software!
1111

12-
Mostly what you'll be learning is 2 things:
12+
You'll be learning two main things:
1313

14-
- The skill of problem solving.
15-
- The skill of thinking algorithmically
14+
1. Various fundamental concepts within programming
15+
While we're using JavaScript to illustrate these concepts, it's important to keep in mind that what you will learn is applicable to **any** programming language. They might differ in syntax (a fancy way of saying the way the arrangement of words in a language in order for it to make sense), but the functionality will be the same: a loop will always be a loop.
1616

17-
You will learn to understand problems terms of an algorithm: a series of steps that can be used to do a certain thing, even if the details are different each time.
17+
This should be your mindset when you're learning concepts: **I'm learning how to become a software developer that can adjust to any language used, because I know what the underlying principles and concepts are**.
18+
19+
2. How to think like a programmer
20+
In one sentence this means: **knowing how to solve problems computationally**. Let's split that up in two parts: `how to solve problems` refers to the ability to identify issues and find effective solutions. `computationally` refers to the ability to think in logical steps that the computer can understand and execute.
21+
22+
This should be your mindset when you're learning how to think : **I'm learning how to think in logical steps, identifying cause and effect, and always looking for solutions**.
23+
24+
## Before you start!
25+
26+
In order to test your JavaScript you'll be using software that will execute your files from the command line. This software is called [Node.js](https://nodejs.org/en/download/). Download the Long-Term Support (LTS) version for your specific operating system.
27+
28+
- For Windows, click [here](https://nodejs.org/dist/v10.16.0/node-v10.16.0-x64.msi)
29+
- For Mac, click [here](https://nodejs.org/dist/v10.16.0/node-v10.16.0.pkg)
30+
- For Linux, click [here](https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz)
31+
32+
After you've installed it, go to your command line interface. Type in the following command:
33+
34+
```
35+
node --version
36+
```
37+
38+
It should show you version `v10.14.2` or higher.
1839

1940
## Learning goals
2041

2142
In order to successfully complete this module you will need to master the following:
2243

2344
- Have an idea of what computer programming is
2445
- Learn about the basic buildings of JavaScript
25-
- Correctly write variables, functions and loops
46+
- Correctly write and use variables, functions and loops
2647
- Understand the control flow
48+
- Learn how to think like a programmer
2749

2850
## How to use this repository
2951

30-
> Before you do anything, first go [here](Week0/preparation.md).
31-
3252
This repository consists of 3 essential parts:
3353

3454
1. `Reading materials`: this document contains all the required theory you need to know _**while**_ you're coding. It's meant as both study material and as a reference to understand what you're doing.
@@ -45,14 +65,12 @@ If you have any questions or if something is not entirely clear ¯\\\_(ツ)\_/¯
4565
| ---- | --------------------------------------------------------------------------------- | ------------------------------ | ------------------------------- | ---------------------------------- |
4666
| 1. | What is JavaScript?, Variables, Data Structures & Naming Conventions | [Reading W1](/Week1/README.md) | [Homework W1](/Week1/MAKEME.md) | [Lesson Plan W1](/Week1/MAKEME.md) |
4767
| 2. | Statements vs. Expressions, Control flow, Loops, Operators, Conditional statement | [Reading W2](/Week2/README.md) | [Homework W2](/Week2/MAKEME.md) | [Lesson Plan W2](/Week1/MAKEME.md) |
48-
| 3. | Functions, Thinking like a programmer I | [Reading W3](/Week3/README.md) | [Homework W3](/Week3/MAKEME.md) | [Lesson Plan W3](/Week1/MAKEME.md) |
49-
50-
**Kind note:**
68+
| 3. | Functions, Thinking like a programmer I, How JavaScript relates to HTML/CSS | [Reading W3](/Week3/README.md) | [Homework W3](/Week3/MAKEME.md) | [Lesson Plan W3](/Week1/MAKEME.md) |
5169

52-
We expect you to **always** come prepared to the class on Sunday.
70+
## Finished?
5371

54-
### Overall
72+
Did you finish the module? Good job! You're doing great!
5573

56-
A good understanding of all the above mentioned topics. Want to check your Knowledge? Go through the [JavaScript Fundamentals README](../../../fundamentals/blob/master/README.md) and research/ ask for help (Slack!) with the concepts that are not entirely clear.
74+
If you feel ready for the next challenge, click [here](https://www.github.com/HackYourFuture/JavaScript2) to go to JavaScript2!
5775

5876
_The HackYourFuture curriculum is subject to CC BY copyright. This means you can freely use our materials, but just make sure to give us credit for it :)_

Week1/MAKEME.md

Lines changed: 152 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,173 @@
22

33
## Todo list
44

5-
1. JavaScript exercises
6-
2. s
7-
5+
1. Get to know
6+
2. JavaScript exercises
87
3. Code along
98
4. PROJECT:
109

11-
### 1. JavaScript exercises
10+
### 1. Get to know
11+
12+
Before we learn how to build actual applications, we first need to gain experience using JavaScript in a computational way. This teaches us how to think like a programmer, and gives us more experience with the language itself.
13+
14+
In the following exercises you'll learn how to use different JavaScript concepts to solve common computational problems:
15+
16+
- [Learn-js](https://www.learn-js.org/). Do all the `Learn the basics` exercises.
17+
- [Codecademy: Introduction to JavaScript](https://www.codecademy.com/learn/introduction-to-javascript/modules/learn-javascript-introduction). Do all the exercises (#1 to #10).
18+
- [FreeCodeCamp: Introduction to JavaScript](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript). Do at least 20 exercises, you can choose whichever ones you feel are challenging enough.
19+
20+
### 2. JavaScript exercises
21+
22+
Inside of your `JavaScript1` fork, create a folder called `week1`. Inside of that folder, create a folder called `js-exercises`. For all the following exercises create a new `.js` file in that folder (10 files in total). Make sure the name of each file reflects its content: for example, the filename for exercise one could be `logHello.js`.
23+
24+
In each file, start off with the string `'use strict'`. This will make sure the code interpreter will enforce stronger rules when looking at your code.
25+
26+
> Before starting, make sure you have [Node.js](https://nodejs.org/en/download/) installed on your computer. You'll use this to execute your code to check if it works.
27+
28+
**Exercise 1: Hello world!**
29+
30+
Write a statement, using the `console.log()` function. Give it a string as an argument. The string should contain the message "Hello world!".
31+
32+
Write 10 statements like these, but in different languages.
33+
34+
For example:
35+
36+
```
37+
Halo, dunia! // Indonesian
38+
Ciao, mondo! // Italian
39+
Hola, mundo! // Spanish
40+
```
41+
42+
Using the command line, navigate to your `week1` folder and type in the following to test your code:
43+
44+
```
45+
node FILENAME.js
46+
```
47+
48+
It should show the message `Hello world!` in 10 different languages.
49+
50+
**Exercise 2: Error debugging**
51+
52+
Consider the following code:
53+
54+
```js
55+
console.log('I'm awesome');
56+
```
57+
58+
Copy the code in your `.js` file and run it in the command line using `node`. You will see that you will get a SyntaxError. **Correct the mistake**.
59+
60+
Hint: the SyntaxError message will give you some indication of what the error _might_ be, but figure out yourself how to correct it!
61+
62+
When done right, it should show the message `I'm awesome`.
63+
64+
**Exercise 3: Log the number**
65+
66+
Follow the steps. Make sure that each step is written on the line after. The file should have 6 lines (excluding the 'use strict') in total.
1267
13-
- Codecademy [Introduction to JavaScript](https://www.codecademy.com/learn/introduction-to-javascript/modules/learn-javascript-introduction)
14-
- FreeCodeCamp [Introduction to JavaScript](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript)
68+
1. First, _declare_ your variable `numberX`. Do not _initialize_ it (which means, don't give it a value) yet.
69+
2. Add a `console.log` statement that explains in words _what you think_ the value of `x` is, like in this example.
70+
3. Add a `console.log` statement that logs the value of `numberX`.
71+
4. Now _initialize_ your variable `numberX` with a number (also called an `integer` in computer science terms).
72+
5. Next, add a `console.log` statement that explains _what you think_ the value of `numberX` is.
73+
6. Add a `console.log` statement that logs the value of `numberX`.
1574
16-
### 2.
75+
**Exercise 4: Log the string**
76+
77+
Follow the steps. Make sure that each step is written on the line after. The file should have 6 lines (excluding the 'use strict') in total.
78+
79+
1. Declare a variable `myString` and assign a string to it. Use your full name, including spaces, as the content for the string.
80+
2. Write a `console.log` statement in which you explain in words _what you think_ the value of the string is.
81+
3. Now `console.log` the variable `myString`.
82+
4. Now reassign to the variable `myString` a new string.
83+
5. Just like what you did before write a `console.log` statement that explains in words _what you think_ will be logged to the console.
84+
6. Now console.log `myString` again.
85+
86+
**Exercise 5: Round a number and log it**
87+
88+
Follow the steps. Make sure that each step is written on the line after. The file should have 6 lines (excluding the 'use strict') in total.
89+
90+
1. Declare a variable `z` and assign the number 7.25 to it.
91+
2. Write a `console.log` statement in which you log the value of `z`.
92+
3. Declare another variable `a` that has the value of `z` but rounded to the nearest integer.
93+
4. Write a `console.log` statement in which you log the value of `a`.
94+
5. So now we have `z` and `a` find a way to compare the two values and store the highest of the two in a new variable.
95+
6. Write a `console.log` statement in which you log the value of the highest value.
96+
97+
**Exercise 6: Log an array of animals**
98+
99+
Follow the steps. Make sure that each step is written on the line after. The file should have 7 lines (excluding the 'use strict') in total.
100+
101+
1. Declare variable and assign to it an empty array. Make sure that the name of the variable indicates it contains more than 1 item. For example `items` instead of `item`.
102+
2. Write a `console.log` statement that explains in words _what you think_ the value of the array is.
103+
3. Write a `console.log` statement that logs the array.
104+
4. Create a new variable with an array that has 3 of your favorite animals, each in a different string. Make sure the name of the variables says something about what the variable contains.
105+
5. Write a `console.log` statement that logs the second array.
106+
6. Add a statement that adds another string ("Piglet)" to the array of animals.
107+
7. Write a `console.log` statement that logs the second array!
108+
109+
**Exercise 7: Log the length of a string**
110+
111+
1. Declare a variable called `mySentence` and initialize it with the following string: "Programming is so interesting!".
112+
2. Figure out (using Google) how to get the length of `mySentence`.
113+
3. Write a `console.log` statement to log the length of `mySentence`.
114+
115+
**Exercise 8: **
116+
117+
8.0 Write a program that checks the types of two variables and prints out `SAME TYPE` if they are the same type.
118+
8.1 First declare at least four variables and assign them different data types.
119+
8.2 For each variable write a `console.log` statement that logs the value
120+
121+
```js
122+
let foo = 3;
123+
console.log("The value of my variable foo is: " + foo);
124+
```
125+
126+
(Curious to know what a `foo` is? Check [this article](https://en.wikipedia.org/wiki/Metasyntactic_variable) on Wikipedia.)
127+
128+
8.3 Now write a `console.log` statement wherein you first explain in words what you think the _type_ of your variables is.
129+
8.4 Now use `typeof` to log the actual _type_ of your variables.
130+
8.5 Now compare the types of your different variables with one another.
131+
8.6 Make sure to also show a message when the variables you are comparing are not the same type.
132+
133+
For example:
134+
135+
```js
136+
let x = 9;
137+
let y = 'Hello';
138+
139+
if (...) {
140+
console.log('SAME TYPE');
141+
}
142+
// TODO -> add a way of giving feedback if your variables don't have the same type
143+
```
144+
145+
**Exercise 9:**
146+
147+
9.0 If `x` equals 7, and the only other statement is `x = x % 3`, what would be the new value of `x`?
148+
9.1 Add at least 3 `console.log` statements in which you show that you understand what `%` does.
149+
150+
**Exercise 10:**
151+
152+
10.0 Write a program to answer the following questions:
153+
10.1 Can you store multiple types in an array? Numbers and strings? Make an example that illustrates your answer.
154+
10.2 Can you compare infinities? (Not in Eyad's world) - does 6/0 === 10/0? How can you test this?
155+
10.3 Add `console.log` statements to the above program in which you show that you understand the concepts (just like you've done in the above assignments).
17156
18157
### 3. Code along
19158
159+
We don't want to lose connection with HTML/CSS, so in the following tutorial you'll learn how to build a simple web application use HTML/CSS and JavaScript.
160+
20161
### 4. PROJECT:
21162
22-
> Every week ends with a project you have to build on your own. Instead of getting clear-cut instructions, you'll get a list of criteria that your project needs to measure up to.
163+
Every week ends with a project you have to build on your own. Instead of getting clear-cut instructions, you'll get a list of criteria that your project needs to measure up to.
23164
24165
## SUBMIT YOUR HOMEWORK!
25166
26167
After you've finished your todo list it's time to show us what you got! The homework that needs to be submitted is the following:
27168
28-
1. s
29-
2. s
169+
1. JavaScript exercises
170+
2. Project
30171
31-
Upload both in a repository to GitHub and then upload the link to Trello. Go through the [guide](../hand-in-homework-guide.md) to learn how to do this.
172+
Go through the [guide](../hand-in-homework-guide.md) to learn how to do this.
32173
33174
_Deadline Saturday 23.59 CET_

Week2/MAKEME.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22

33
## Todo list
44

5-
1. s
6-
2. s
7-
3. Code along
8-
4. PROJECT:
5+
1. JavaScript exercises
6+
2. Code along
7+
3. PROJECT:
98

109
### 1.
1110

1211
### 2.
1312

1413
### 3. Code along
1514

16-
Build a temperature converter
15+
So far you've been practicing with JavaScript by itself. This is useful, but we shouldn't lose the connection between this and what we learned before: HTML & CSS.
16+
17+
In the following tutorial you'll learn how to combine JavaScript with HTML & CSS in order to build a simple calculator:
1718

18-
- [Temperature Converter](https://www.youtube.com/watch?v=8mRGfLL1nzE)
19+
- [Calculator]()
1920

2021
### 4. PROJECT:
2122

@@ -30,7 +31,7 @@ After you've finished your todo list it's time to show us what you got! The home
3031
1. s
3132
2. s
3233

33-
Upload both in a repository to GitHub and then upload the link to Trello. Go through the [guide](../hand-in-homework-guide.md) to learn how to do this.
34+
Go through the [guide](../hand-in-homework-guide.md) to learn how to do this.
3435

3536
_Deadline Saturday 23.59 CET_
3637

Week3/MAKEME.md

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,18 @@
1-
## Homework JavaScript1 Week 3
1+
# Homework JavaScript1 Week 3
22

3-
# Todo list
3+
## Todo list
44

55
1. JavaScript exercises
66
2. s
77

88
3. Code along
99
4. PROJECT:
1010

11-
## Step 1: Recap/Read
11+
## 3. Code along
1212

13-
- Have a look at [The Secret Life of JavaScript Primitives](https://javascriptweblog.wordpress.com/2010/09/27/the-secret-life-of-javascript-primitives/)
13+
Build a temperature converter
1414

15-
- Review the topics of last week:
16-
17-
- [Variables](./../../../../fundamentals/blob/master/fundamentals/variables.md)
18-
- [Values](./../../../../fundamentals/blob/master/fundamentals/values.md)
19-
- [Operators](./../../../../fundamentals/blob/master/fundamentals/operators.md)
20-
- [Special characters and their names](./../../../../fundamentals/blob/master/fundamentals/names_of_special_characters.md)
21-
- [Naming conventions](./../../../../fundamentals/blob/master/fundamentals/naming_conventions.md)
22-
23-
- Go through the topics of this week:
24-
- Git work flow
25-
- [Advanced data types (Objects)](./../../../../fundamentals/blob/master/fundamentals/objects.md)
26-
- [Conditional execution](./../../../../fundamentals/blob/master/fundamentals/conditional_execution.md)
27-
- [Statements vs Expressions](./../../../../fundamentals/blob/master/fundamentals/statements_expressions.md)
28-
- [Loops (for/while)](./../../../../fundamentals/blob/master/fundamentals/loops.md)
29-
- [Functions](./../../../../fundamentals/blob/master/fundamentals/functions.md)
30-
- [Scope](./../../../../fundamentals/blob/master/fundamentals/scope.md)
15+
- [Temperature Converter](https://www.youtube.com/watch?v=8mRGfLL1nzE)
3116

3217
## Step 2: Watch
3318

@@ -192,4 +177,4 @@ After you've finished your todo list it's time to show us what you got! The home
192177

193178
Upload both in a repository to GitHub Go through the [guide](../hand-in-homework-guide.md) to learn how to do this.
194179

195-
_Deadline Saturday 23.59 CET_
180+
Go through the [guide](../hand-in-homework-guide.md) to learn how to do this.

Week3/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ These are the topics for week 3:
66

77
1. Functions
88
2. Thinking like a programmer I
9+
3. How JavaScript relates to HTML & CSS
910

1011
## 1. Functions
1112

@@ -68,6 +69,21 @@ Take a look at the following resources to learn more about problem solving as ap
6869

6970
- [How to THINK like a programmer](https://www.youtube.com/watch?v=NNazO2tMHno)
7071
- [Lessons in problem solving](https://www.freecodecamp.org/news/how-to-think-like-a-programmer-lessons-in-problem-solving-d1d8bf1de7d2/)
72+
- [Computational thinking](https://www.youtube.com/watch?v=qbnTZCj0ugI)
73+
74+
## 3. How JavaScript relates to HTML & CSS
75+
76+
Consider the following analogy. The human body needs 3 essential parts in order to function appropriately: bones, skin and muscles. The bones are necessary to give the body **structure**. The skin (shape of body, hair, clothing, make up) is necessary to give the body a unique **presentation**. and the muscles (for walking, climbing, swimming) are needed to give the body **movement and interactivity**.
77+
78+
This is exactly how HTML, CSS and JavaScript relate to each other:
79+
80+
- HTML is used to put the structure of a website together
81+
- CSS acts like the skin and makeup for the HTML. CSS improves the colors and layout of a website structure built with HTML
82+
- JavaScript is a full-on programming language that adds interactivity and functionality to a website
83+
84+
Check the following article to learn more about this:
85+
86+
- [The Relationship Between HTML, CSS and JavaScript Explained by Building A City](https://blog.codeanalogies.com/2018/05/09/the-relationship-between-html-css-and-javascript-explained/)
7187

7288
## Finished?
7389

0 commit comments

Comments
 (0)