diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..723ef36f4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.idea
\ No newline at end of file
diff --git a/README.md b/README.md
index c0e9e63a7..5e3f75cff 100644
--- a/README.md
+++ b/README.md
@@ -1,33 +1,28 @@
-> If you are following the HackYourFuture curriculum we recommend you to start with module 1: [HTML/CSS/GIT](https://github.com/HackYourFuture/HTML-CSS). To get a complete overview of the HackYourFuture curriculum first, click [here](https://github.com/HackYourFuture/curriculum).
-
-> Please help us improve and share your feedback! If you find better tutorials
-> or links, please share them by [opening a pull request](https://github.com/HackYourFuture/JavaScript1/pulls).
-
-# Module #2 - JavaScript 1: Programming Basics (Frontend)
-
-
+# DEPRECATED - JavaScript 1
+This module has been replace with the JavaScript module, find it [here](https://github.com/HackYourFuture/JavaScript)
+```
In this module you'll make a start into wonderful world of programming. We will be using the programming language `JavaScript` to do so. You'll learn about the basic building blocks 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!
You'll be learning two main things:
-1. Fundamental concepts in programming
- 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 term for 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.
+1. **Fundamental concepts in programming**. 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 term for 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.
- 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**.
+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**.
-2. How to think like a programmer
- 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.
+2. **How to think like a programmer**. In one sentence this means: knowing how to solve problems using a computer. 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.
- 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**.
+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**.
## Before you start!
+### 1. Install some new software!
+
In order to test your JavaScript code, 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.
-- For Windows, click [here](https://nodejs.org/dist/v10.16.0/node-v10.16.0-x64.msi)
-- For Mac, click [here](https://nodejs.org/dist/v10.16.0/node-v10.16.0.pkg)
-- For Linux, click [here](https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz)
+- For Windows, click [here](https://nodejs.org/dist/v12.16.1/node-v12.16.1-x86.msi)
+- For Mac, click [here](https://nodejs.org/dist/v12.16.1/node-v12.16.1.pkg)
+- For Linux, click [here](https://nodejs.org/dist/v12.16.1/node-v12.16.1-linux-x64.tar.xz)
After you've installed it, go to your command line interface. Type in the following command:
@@ -35,37 +30,92 @@ After you've installed it, go to your command line interface. Type in the follow
node --version
```
-It should show you version `v10.14.2` or higher.
+It should show you version `v12.16.1` or higher.
+
+### 2. A new way of submitting homework!
+
+Starting from this module you'll submit homework in a different way. You will be only using GIT and GitHub and work **like a real developer would**: pushing code from your computer to GitHub and making pull requests!
+
+Before you start with the homework, make a `fork` of the following repository: [HackYourHomework/JavaScript1](https://www.github.com/hackyourhomework/javascript1). You'll always use the **HackYourHomework** version of the module repository whenever you have to submit your homework.
+
+Here are the steps to get started:
+
+1. `fork` the HackYourHomework repository to your personal account.
+2. `clone` your forked repository to your computer.
+3. Make `GIT` branches for each week. Start at the `master` branch and execute the following (note that they're 3 different commands):
+
+`console
+foo@bar:~$ git branch week1-YOURNAME
+foo@bar:~$ git branch week2-YOURNAME
+foo@bar:~$ git branch week3-YOURNAME
+`
+
+4. `checkout` to `week1-YOURNAME`
+5. Get started with making your homework!
+
+Here's a video in order that shows you how it's done: [How to Submit Your Homework](https://www.youtube.com/watch?v=CpYARPYGQU8)
+
+### 3. Presentation module
+Besides learing a lot of technical concepts you'll be focussing on the softskills as well. Please have a look at [this](https://github.com/HackYourFuture/presentation-module) RePo for more details.
## Learning goals
In order to successfully complete this module you will need to master the following:
-- Have an idea of what computer programming is
-- Know the basic buildingblocks of JavaScript
-- Correctly write and use variables, functions and loops
-- Understand the control flow
-- Think like a programmer
+- Have an idea of what `computer programming` is
+- Know the basic building blocks of `JavaScript`
+- Correctly write and use `variables`, `functions` and `loops`
+- Understand the `control flow`
## How to use this repository
-This repository consists of 3 parts:
+### Repository content
+
+This repository consists of 3 essential parts:
+
+1. `README`: this document contains all the required theory you need to understand **while** working on the homework. It contains not only the right resources to learn about the concepts, but also lectures done by HackYourFuture teachers. This is the **first thing** you should start with every week
+2. `MAKEME`: this document contains the instructions for each week's homework. Start with the exercises rather quickly, so that you can ground the concepts you read about earlier.
+3. `LESSONPLAN`: this document is meant for teachers as a reference. However, as a student don't be shy to take a look at it as well!
+
+### How to study
+
+Let's say you are just starting out with the JavaScript1 module. This is what you do...
+
+1. The week always starts on **Wednesday**. First thing you'll do is open the `README.md` for that week. For the first week of `JavaScript1`, that would be [Week1 Reading](/Week1/README.md)
+2. You spend **Wednesday** and **Thursday** going over the resources and try to get a basic understanding of the concepts. In the meanwhile, you'll also implement any feedback you got on last week's homework (from the HTML-CSS module)
+3. On **Friday** you start with the homework, found in the `MAKEME.md`. For the first week of `JavaScript1`, that would be [Week1 Homework](/Week1/MAKEME.md)
+4. You spend **Friday** and **Saturday** playing around with the exercises and write down any questions you might have
+5. **DEADLINE 1**: You'll submit any questions you might have before **Saturday 23.59**, in the class channel
+6. On **Sunday** you'll attend class. It'll be of the Q&A format, meaning that there will be no new material. Instead your questions shall be discussed and you can learn from others
+7. You spend **Monday** and **Tuesday** finalizing your homework
+8. **DEADLINE 2**: You submit your homework to the right channels (GitHub) before **Tuesday 23.59**. If you can't make it on time, please communicate it with your mentor
+9. Start the new week by going back to point 1!
+
+In summary:
+
+
+
+To have a more detailed overview of the guidelines, please read [this document](https://docs.google.com/document/d/1JUaEbxMQTyljAPFsWIbbLwwvvIXZ0VCHmCCN8RaeVIc/edit?usp=sharing) or ask your mentor/class on Slack!
+
+### Video lectures
+
+For each module HackYourFuture provides you with video lectures. These are made by experienced software developers who know what they're talking about. The main teacher for this module will be [Uday Khaki](https://hackyourfuture.slack.com/team/U3T5HDP0W): former HackYourFuture student and now successful web developer for several years!
+
+You can find out more about him here:
-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.
-2. `Homework`: this document contains the instructions for each week's homework.
-3. `Lesson Plans`: this part is meant for teachers as a reference. However, as a student don't be shy to take a look at it as well!
+- [@Uday on Slack](https://hackyourfuture.slack.com/team/U3T5HDP0W)
-After your first class you should start with checking the `reading materials` for that week. So, for the first time that is the [Week 1 Reading](/Week1/README.md). Study all the concepts and try to get the gist of everything. After, you can get started with the `homework` for that week.
+Learn from Uday in the following playlist of videos he has made for you! (Click on the image to open the link)
-If you have any questions or if something is not entirely clear ¯\\\_(ツ)\_/¯, please ask/comment on Slack!
+
## Planning
-| Week | Topic | Reading Materials | Homework | Lesson Plan |
-| ---- | --------------------------------------------------------------------------------- | ------------------------------ | ------------------------------- | -------------------------------------- |
-| 1. | What is JavaScript?, Variables, Data Structures & Naming Conventions | [Reading W1](/Week1/README.md) | [Homework W1](/Week1/MAKEME.md) | [Lesson Plan W1](/Week1/LESSONPLAN.md) |
-| 2. | Statements vs. Expressions, Control flow, Loops, Operators, Conditional statement | [Reading W2](/Week2/README.md) | [Homework W2](/Week2/MAKEME.md) | [Lesson Plan W2](/Week1/LESSONPLAN.md) |
-| 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/LESSONPLAN.md) |
+| Week | Topic | Reading Materials | Homework | Lesson Plan |Presentation module |
+| ---- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |-----------|
+| 1. | What is JavaScript?, Variables, Data Structures & Naming Conventions | [Reading W1](https://github.com/HackYourFuture/JavaScript1/tree/master/Week1/README.md) | [Homework W1](https://github.com/HackYourFuture/JavaScript1/tree/master/Week1/MAKEME.md) | [Lesson Plan W1](https://github.com/HackYourFuture/JavaScript1/tree/master/Week1/LESSONPLAN.md) |[W1 presentations](https://github.com/HackYourFuture/presentation-module/blob/main/week1.md) |
+| 2. | Statements vs. Expressions, Control flow, Loops, Operators, Conditional statement | [Reading W2](https://github.com/HackYourFuture/JavaScript1/tree/master/Week2/README.md) | [Homework W2](https://github.com/HackYourFuture/JavaScript1/tree/master/Week2/MAKEME.md) | [Lesson Plan W2](https://github.com/HackYourFuture/JavaScript1/tree/master/Week2/LESSONPLAN.md) |[W2 presentation](https://github.com/HackYourFuture/presentation-module/blob/main/week2.md) |
+| 3. | Functions, Thinking like a programmer I, How JavaScript relates to HTML/CSS | [Reading W3](https://github.com/HackYourFuture/JavaScript1/tree/master/Week3/README.md) | [Homework W3](https://github.com/HackYourFuture/JavaScript1/tree/master/Week3/MAKEME.md) | [Lesson Plan W3](https://github.com/HackYourFuture/JavaScript1/tree/master/Week3/LESSONPLAN.md) |
## Finished?
@@ -75,4 +125,4 @@ If you feel ready for the next challenge, click [here](https://www.github.com/Ha
_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 :)_
- This work is licensed under a Creative Commons Attribution 4.0 International License.
+ This work is licensed under a Creative Commons Attribution 4.0 International License.```
diff --git a/Week1/LESSONPLAN.md b/Week1/LESSONPLAN.md
index f8beb0910..66ffd2359 100644
--- a/Week1/LESSONPLAN.md
+++ b/Week1/LESSONPLAN.md
@@ -6,6 +6,7 @@ The purpose of this class is to introduce to the student:
- The 2 types of websites: static vs. dynamic
- The pillars of web development: HTML/CSS/JavaScript
+ - where JavaScript can run: Browser / Node
- What are variables
- How to name variables properly
- What are the basic data types
@@ -13,13 +14,13 @@ The purpose of this class is to introduce to the student:
## Core concepts
-*FIRST HALF (12.00 - 13.30)*
+_FIRST HALF (12.00 - 13.30)_
## 1. The 2 types of websites: static vs. dynamic
### Explanation
-Static websites usually come with a fixed number of pages that have a specific layout. When the page runs on a browser, the content is literally static and doesn’t change in response to user actions. A static website is usually created with HTML and CSS
+Static websites usually come with a fixed number of pages that have a specific layout. When the page runs on a browser, the content is literally static and doesn’t change in response to user actions. A static website is usually created with HTML and CSS
Compared to static websites, which are purely informational, a dynamic website is more functional. It allows users to interact with the information that is listed on the page. Of course, that requires utilizing more than just HTML code.
### Example
@@ -33,37 +34,37 @@ Examples the two different kind of websites
Discuss in class which claim belongs to which type of website:
- Content of Web pages can not be change at runtime.
- Server side languages such as PHP, Node.js are used.
- Content of Web pages can be changed.
- No interation with database possible.
- Interaction with database is possible
- It is faster to load as compared to the other typ of website.
- It is slower then static website.
- Lower Development costs.
- Content may change everytime the page is loaded.
- Feature of Content Management System.
- HTML, CSS, Javascript is used for developing the website.
- Same content is delivered everytime the page is loaded.
-
+- Content of Web pages can not be change at runtime.
+- Server side languages such as PHP, Node.js are used.
+- Content of Web pages can be changed.
+- No interaction with database possible.
+- Interaction with database is possible
+- It is faster to load as compared to the other typ of website.
+- It is slower then static website.
+- Lower Development costs.
+- Content may change every time the page is loaded.
+- Feature of Content Management System.
+- HTML, CSS, Javascript is used for developing the website.
+- Same content is delivered every time the page is loaded.
+
### Essence
[In the link is an article with (dis)advantages of both static and dynamic websites.](https://www.spiderwriting.co.uk/static-dynamic.php)
-
- Static:
+
+ Static:
Advantage:
- Flexible
- Cheaper
Disadvantages:
- not updating content
- Scalability
-
+
Dynamic:
Advantage:
- - Easy to pull in data on stuctured and organised way
- - Content management system
+ - Easy to pull in data on stuctured and organised way
+ - Content management system
Disadvantage:
- - Design is more fixed, becasue the pages are more of a template
+ - Design is more fixed, because the pages are more of a template
- Costs
## 2. The pillars of web development: HTML/CSS/JavaScript
@@ -73,6 +74,9 @@ Discuss in class which claim belongs to which type of website:
- HTML defines what the content is.
- CSS defines the appearance of the page.
- JavaScript defines behavior of the page.
+- Where can JavaScript run:
+ - browser
+ - Node
### Example
@@ -80,6 +84,7 @@ Discuss in class which claim belongs to which type of website:
### Exercise
+Let students fork and then clone the repository.
Let students create a classwork directory and create an index.html along with an app.js. Script tag should be added to the end of body tag(reason for doing so is part of JS2 Week1).
The end result should look like:
@@ -98,13 +103,13 @@ These static pages can interact with a visitor only through the use of forms. On
A big disadvantage of web pages like this is that the only way that a visitor has of interacting with the page is by filling out the form and waiting for a new page to load.
-It doesn't exhibit any dynamic behaviour like:
+It doesn't exhibit any dynamic behavior like:
1. reacting to user actions such as mouse click events or key presses.
-1. rendering complex animations
-1. sending requests over network to servers and fetching a response
-1. and this is where JavaScript steps in.
-
+2. rendering complex animations
+3. sending requests over network to servers and fetching a response
+4. and this is where JavaScript steps in.
+
## 3. What are variables (const & let) & naming conventions
### Explanation
@@ -127,6 +132,7 @@ Three different stages of working with variables are:
- Variable assignment means throwing away the old value of a variable and replacing it with a new one. Initialization can be thought of as a special way of assignment.
https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/variables.md
+
### Example
```javascript
@@ -142,8 +148,10 @@ console.log(age);
```javascript
// Variable Initialization
-var firstName = 'Yash';
-let lastName = 'Kapila';
+
+var firstName = "Yash";
+let lastName = "Kapila";
+
const age = 29;
console.log(firstName);
@@ -152,15 +160,15 @@ console.log(age);
```
```javascript
-var firstName = 'Tom';
-let lastName = 'Hanks';
+var firstName = "Tom";
+let lastName = "Hanks";
console.log(firstName);
console.log(lastName);
// Assigning variables to a different value
-firstName = 'Hanks';
-lastName = 'Tom';
+firstName = "Hanks";
+lastName = "Tom";
console.log(firstName);
console.log(lastName);
@@ -169,12 +177,14 @@ console.log(lastName);
### Exercise
1. Create 2 variables using the `let` keyword
- 1. make 1 variable contain your first name
- 1. the second variable should have no value assigned
-
+
+ - make 1 variable contain your first name
+ - the second variable should have no value assigned
+
1. Make 2 variables using the `const` keyword
- 1. the first variable should contain the city you currently stay at
- 1. come up with a value for the second variable yourself
+ - the first variable should contain the city you currently stay at
+ - come up with name and a value for the second variable yourself
+
### Essence
@@ -184,56 +194,83 @@ For example, your name and age are simple pieces of information, a string and a
Variables are simply named storage/pointer for this information.
-*SECOND HALF (14.00 - 16.00)*
+_SECOND HALF (14.00 - 16.00)_
## 4. The basic data types (string, boolean, number, undefined, null)
### Explanation
-Primitive data types are typically types that are built-in or basic to a language implementation.
-There are 5 different types of data. The compiler/computer interpretates all the variables we make as one of those datatypes.
-(https://javascript.info/types)
+In JavaScript, a primitive (primitive value, primitive data type) is data that is not an object and has no methods. There are 7 primitive data types: `string`, `number`, `bigint`, `boolean`, `null`, `undefined`, and `symbol`.
Boolean — true or false
Null — no value
Undefined — a declared variable but hasn’t been given a value
Number — integers, floats, etc
String — an array of characters i.e words
-?? Symbol — a unique value that's not equal to any other value ??
+Symbol — a unique value that's not equal to any other value (not used during HYF)
+
### Example
-* `string`, e.g. "HackYourFuture"
-* `number`, e.g. 5, or 10.6
-* `boolean`, e.g. `true` or `false`
-* `array`\*, e.g. `[1, 2, 3]` or `['what', 'is', 'your', 'name']`
-* `null and undefined` The values `null` and `undefined` are very similar in JavaScript, but they behave a bit differently. The difference is that `null` always has type "object", and `undefined` always has type "undefined".
-Whenever you declare a variable, but you don't set a value, the variable will become `undefined`. JavaScript will never make a variable `null` unless you explicitly program it.
-* `symbol`
+- `string`, e.g. "HackYourFuture"
+- `number`, e.g. 5, or 10.6
+- `boolean`, e.g. `true` or `false`
+- `array`, e.g. `[1, 2, 3]` or `['what', 'is', 'your', 'name']`
+- `null` \*
+- `undefined` \*
+- `symbol` e.g. `new Symbol('example')`
+\* The values `null` and `undefined` are very similar in JavaScript, but they behave a bit differently. The difference is that `null` always has type "object", and `undefined` always has type "undefined".
+Whenever you declare a variable (using `let`), but you don't set a value, the variable will become `undefined`. JavaScript will never make a variable `null` unless you explicitly program it.
-```js
-let x = 5;
-let typeOfX = typeof x; // -> "number"
-```
+### Exercise
-### Exercise
-Everybody has two minutes to find a way to declare all basic data types by making use of the typeof operator:
+Everybody has four minutes to find a way to store all basic data types in a variable by making use of the typeof operator:
+
```js
let x = 5;
let typeOfX = typeof x; // -> "number"
```
+
### Essence
-In this way we can store a lot of data in a compact way, while the computer/compiler knows how to interpretate the 1's and 0's/
+
+In this way we can store a lot of data in a compact way, while the computer/compiler knows how to interpret the 1's and 0's/
## 5. The compound data types (object, array)
### Explanation
+Pieces of information often form a group. For example the names of all the students in this class can be grouped together
+as a list. In JavaScript lists are stored in a datatype called an `Array`.
+
+Another way pieces of information can form a group are multiple properties of the same thing. For example the dimensions
+of this room: length, width, height. These groups of information are stored in a datatype called an `Object`.
+
### Example
-* `array`\*, e.g. `[1, 2, 3]` or `['what', 'is', 'your', 'name']`
-* `object`, e.g. `{name: 'John', age: 24}`, or the special object `null`
+
+- `array`\*, e.g. `[1, 2, 3]` or `['Gijs', 'Jim', 'Noer', 'Wouter']`
+- `object`, e.g. `{name: 'Wilgert', shoeSize: 42}`, or the special object `null`
+
### Exercise
+
+1. Create a list of your favorite types of food/dishes like this:
+
+```js
+const foods = ['Chocolate', 'Risotto', 'Tuna melt'];
+```
+
+2. Create an object that contains the properties of your town/city like this:
+
+```js
+const city = {
+ name: 'Huizen',
+ province: 'Noord-Holland',
+ population: 50000,
+ capital: false,
+};
+```
+
### Essence
-_Special thanks to Jim Cramer, Yash Kapila, David Nudge for most of the content_
+- Object key: value
+- Array numeric index: value
diff --git a/Week1/MAKEME.md b/Week1/MAKEME.md
index 787b50988..9b5330f0f 100644
--- a/Week1/MAKEME.md
+++ b/Week1/MAKEME.md
@@ -26,9 +26,11 @@ In the following exercises you'll learn how to use different JavaScript concepts
**Exercise 1: Hello world!**
-Write a statement, using the `console.log()` function. Give it a string as an argument. The string should contain the message "Hello world!".
+Write a statement, using the `console.log()` function. It should fulfill the following requirements:
-Write 10 statements like these, but in different languages.
+- It takes a string as an argument
+- The string should contain the message `"Hello world!"`
+- Execute the function 10 times, each time using the phrase in different languages
For example:
@@ -38,38 +40,44 @@ Ciao, mondo! // Italian
Hola, mundo! // Spanish
```
-Using the command line, navigate to your `js-exercises` folder and type in the following to test your code:
+Finished? Using the command line, navigate to your `js-exercises` folder and type in the following to test your code:
-```
-node FILENAME.js
+```console
+foo@bar:~$ node FILENAME.js
```
-It should show the message `Hello world!` in 10 different languages.
+Expected output: It should show the message `Hello world!` in 10 different languages.
**Exercise 2: Error debugging**
Consider the following code:
```js
-console.log('I'm awesome');
+console.log('I'm awesome'!;
```
-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**.
+Here are the requirements:
+
+- 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](https://techterms.com/definition/syntax_error).
-Hint: the SyntaxError message will give you some indication of what the error _might_ be, but figure out yourself how to correct it!
+- **Correct the mistake**.
-When done right, it should show the message `I'm awesome`.
+> Hint: the SyntaxError message will give you some indication of what the error _might_ be, but figure out yourself how to correct it!
+
+Expected output: When done right, the command line should show the message `I'm awesome!`.
**Exercise 3: Log the number**
Follow the steps. Make sure that each step is written on the line after.
-1. First, declare your variable `numberX`. Do not _initialize_ it (which means, don't give it a value) yet.
-2. Add a `console.log` statement that explains in words _what you think_ the value of `x` is, like in this example.
+1. First, declare your variable `numberX`. Do not _initialize_ it (which means, don't give it a starting value) yet
+2. Add a `console.log` statement that explains in words _what you think_ the value of `x` is
3. Add a `console.log` statement that logs the value of `numberX`.
-4. Now _initialize_ your variable `numberX` with a number (also called an `integer` in computer science terms).
-5. Next, add a `console.log` statement that explains _what you think_ the value of `numberX` is.
-6. Add a `console.log` statement that logs the value of `numberX`.
+4. Now _initialize_ your variable `numberX` with a number (also called an `integer` in computer science terms)
+5. Next, add a `console.log` statement that explains _what you think_ the value of `numberX` is
+6. Add a `console.log` statement that logs the value of `numberX`
**Exercise 4: Log the string**
@@ -86,7 +94,7 @@ Follow the steps. Make sure that each step is written on the line after.
Follow the steps. Make sure that each step is written on the line after.
-1. Declare a variable `z` and assign the number 7.25 to it.
+1. Declare a variable `z` and assign the number `7.25` to it.
2. Write a `console.log` statement in which you log the value of `z`.
3. Declare another variable `a` that has the value of `z` but rounded to the nearest integer.
4. Write a `console.log` statement in which you log the value of `a`.
@@ -115,7 +123,14 @@ Follow the steps. Make sure that each step is written on the line after.
**Exercise 8: Type checker**
-Write a program that checks the data types of two variables and logs to the console `SAME TYPE` if they are the same type. If they are different types log `Not the same...`.
+Create a `function` that fulfills the following requirements:
+
+- Takes in 2 arguments
+- Check the data type of each
+- Compares each data type
+- Logs to the console the message `SAME TYPE` if they are the same type. If they are different types log `Not the same...`.
+
+Follow the steps:
1. Declare 4 variables: 2 must be `strings` and 2 must be `objects`
2. Create 6 conditional statements, where for each you check if the data type of one variable is the same as the other
@@ -142,7 +157,7 @@ if (...) {
**Exercise 9: Log the remainder**
-For each of these, write in comments what the answer is followed by how you came to that conclusion
+Answer the following questions. For each, write in comments what the answer is followed by how you came to that conclusion:
1. If `x` equals 7, and the only other statement is `x = x % 3`, what would be the value of `x` after the calculation?
2. If `y` equals 21, and the only other statement is `y = y % 4`, what would be the value of `y` after the calculation?
@@ -150,6 +165,8 @@ For each of these, write in comments what the answer is followed by how you came
**Exercise 10: Compare arrays**
+Follow the steps:
+
1. Declare 2 variables, that each hold an array. The first array should have 4 items, the second 7 items
2. Find out how to get the length of each array. Write a `console.log` statement that shows the length of each array
@@ -163,9 +180,11 @@ console.log('The length of the array is...' + ...);
## **3. Code along**
+> Create a new GitHub repository for this project. It's a portfolio piece!
+
We don't want to lose the connection with HTML/CSS, so in the following tutorial you'll learn how to build a simple web application use HTML/CSS and JavaScript.
-You'll first write the HTML and CSS, to provide structure and style to the page. When doing so, keep notice of how the developer chooses to do this. Why do they use this tag instead of something else? Why do they give an element a certain class name?
+You'll first write the HTML and CSS, to provide structure and style to the page. When doing so, notice how the developer chooses to do this. Why do they use this tag instead of something else? Why do they give an element a certain class name?
After, the developer will write JavaScript code. You'll notice it's different from how you've used JavaScript. It is something we call **DOM Manipulation**. Don't worry, you don't need to master this just yet. Just follow along and do some research yourself if you already want to learn more about it!
@@ -173,9 +192,11 @@ After, the developer will write JavaScript code. You'll notice it's different fr
## **SUBMIT YOUR HOMEWORK!**
-After you've finished your todo list it's time to show us what you got! Starting from this week you'll be submitting all your homework through GitHub. What you'll be doing is upload all your files to a forked repository (a copy from the original, which in this case is the [JavaScript1](https://www.github.com/HackYourFuture/JavaScript1) repository) using GIT.
+After you've finished your todo list it's time to show us what you got! Starting from this week you'll be submitting all your homework through GitHub. What you'll be doing is upload all your files to a separate repository.
+
+Go over to [HackYourHomework/JavaScript1](https://www.github.com/HackYourHomework/JavaScript1). Notice how it's **HackYourHomework**, a repository meant to submit the homework!
-Take a look at the following [guide](../hand-in-homework-guide.md) to see how it's done.
+Then take a look at the following [guide](../hand-in-homework-guide.md) to see to set everything up.
The homework that needs to be submitted is the following:
diff --git a/Week1/README.md b/Week1/README.md
index ecfaf004b..bbcac17ac 100644
--- a/Week1/README.md
+++ b/Week1/README.md
@@ -5,7 +5,6 @@
These are the topics for week 1:
1. What is programming?
- - Introduction
- Software
- What is a programming language?
2. What is web development?
@@ -19,44 +18,59 @@ These are the topics for week 1:
5. What are data types?
- 6 basic types
-## 1. What is programming?
+## 0. Video Lectures
+
+Your teacher Uday has made video lectures for this week's material. You can find them here: [Videos 1 - 10](https://www.youtube.com/playlist?list=PLVYDhqbgYpYUiqH8IxLJ5qomkEGMzes1q)
-### Introduction
+
+
+## 1. What is programming?
-Programming is giving a computer instructions written in a language it can understand, in order to solve a problem. We don't necessarily need computers to solve problems, but we use them because they provide several benefits:
+Programming is giving a computer instructions written in a language it can understand, in order to solve a problem you (or the company you work for) have. We don't necessarily need computers to solve problems, but we use them because they provide several benefits:
1. They are fast
2. Cheap to use
3. Can work 24/7 (as long as it has power)
-This is important to note: a computer is a `tool` we use to make our lives easier. In order to use this tool, we need to talk to it in a way it understands (programming language) and give it commands on what to do (programming). However, despite the power a computer has it is not very smart. It can't do anything without being told **exactly** what it needs to do to solve a problem. This is why we learn how to program: in order to tell the computer to do what we want it to do.
+This is important to note: a computer is a `tool` we use to make our lives easier.
+
+- [What is a Computer?](https://www.youtube.com/watch?v=rRSD128KWIM)
+- [What Do Computers Do?](https://www.youtube.com/watch?v=92TaQRBwPSs)
+
+In order to use this tool, we need to talk to it in a way it understands (programming language) and give it commands on what to do (the act of programming). However, despite the power a computer has it is not very smart. It can't do anything without being told **exactly** what it needs to do to solve a problem, step-by-step. This is why we learn how to program: in order to tell the computer to do what we want it to do.
Go through the following resources to learn more about what programming is:
- [What is programming?](https://www.youtube.com/watch?v=3tWMQ3ZMjbg)
+- [What do programmers do?](https://www.youtube.com/watch?v=kEjCfsrotAM)
- [Introduction into programming Playlist](https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZYJC7L-r6rX6utt6wwJCyi)
### Software
-As a software developer (synonym to 'programmer'), you will write these instructions in order to create 'software'. Look at the following video to get a better idea of what software is:
+As a software developer (synonym to 'programmer' or 'software engineer'), you will write these instructions in order to create 'software'. Look at the following video to get a better idea of what software is:
- [What is software?](https://www.youtube.com/watch?v=MSA3WsGeTNI)
### What is a programming language?
-Programming is done using a programming language. Why do we need a language to communicate with the computer? At its most basic level, a computer operates based on 0's and 1's: the 0 means 'off', and the 1 means 'on' (think of it like a light switch that either turns the light on or off).
+Programming is done using a programming language. Why do we need a language to communicate with the computer? At its most basic level, a computer operates based on 0's and 1's: the 0 means 'off', and the 1 means 'on' (think of it like a light switch that either turns the light on or off).
Smart people decided to make working with this easier to understand, so that a lot of people can more simply communicate with a computer. This is how the development of programming languages started: by defining a vocabulary, grammar and syntax to put more organization to the 0's and 1's, we can more simply communicate exactly what we want to computer to do.
+- [What is a programming language?](https://www.youtube.com/watch?v=EGQh5SZctaE)
- [What are programming languages](https://hackr.io/blog/what-is-programming-language)
-There are various languages, each made to fulfill a certain need. For example, Microsoft developed a language called [C#](https://www.youtube.com/watch?v=paJUbVeKEOU) in order to make applications for Windows computers. Read the following article to learn more about different languages and their uses:
+There are various languages, each made to fulfill a certain need. For example, Microsoft developed a language called [C#](https://www.youtube.com/watch?v=paJUbVeKEOU) in order to make applications for computers that run a Windows operating system. The language of C# is able to easily "talk" with the preexisting software.
+
+You will be learning JavaScript, a language that has been made to "talk" to web browsers (Google Chrome, Mozilla Firefox, Safari, Internet Explorer, etc.).
+
+Read the following article to learn more about different languages and their uses:
- [14 Programming Languages Explained](https://mikkegoes.com/14-programming-languages-explained/)
## 1. What is web development?
-In HackYourFuture we focus on `web` programmming (also known as `web development`): writing code that creates websites and web applications. Look at the following video to learn about what you'll be doing:
+In HackYourFuture we focus on `web programmming` (also known as `web development`): writing code that creates websites and web applications. Look at the following video to learn about what you'll be doing:
- [What does a web developer do?](https://www.youtube.com/watch?v=GEfuOMzRgXo)
@@ -64,32 +78,32 @@ In HackYourFuture we focus on `web` programmming (also known as `web development
The field of programming is broad. As a software developer (a general term for anyone that writes code to create software) there are several career paths you might take. The following are some of the biggest:
-1. Web. Developing websites and web applications to be accessed and used in the browser
-2. Mobile. This refers mostly to Android and iOS application development
-3. Desktop. Every application on your computer has been made by desktop developers
-4. Data science. Writing custom programs to extract patterns from big piles of data is what this developer does.
-5. Gaming. Game developers work with a variety of designers, artists and testers to realize a video game
-6. Quality Assurance. Applications need to be tested, and these developers write tests that check for the correct working of any piece of code
+1. **Web**. Developing websites and web applications to be accessed and used in the browser
+2. **Mobile**. This refers mostly to Android and iOS application development
+3. **Desktop**. Every application on your computer has been made by desktop developers
+4. **Data science**. Writing custom programs to extract patterns from big piles of data is what this developer does
+5. **Gaming**. Game developers work with a variety of designers, artists and testers to realize a video game
+6. **Quality Assurance**. Applications need to be tested, and these developers write tests that check for the correct working of any piece of code
Read the following article to read more about different career paths:
- [Software Development Career Paths](https://simpleprogrammer.com/software-development-career-paths/#title-career-developer-options)
-Note: once you've chosen a certain track it doesn't mean you can't try out any other! If anything, you are encouraged to explore and see what fits your taste :)
+Note: once you've chosen a certain track it doesn't mean you can't try out any other! If anything, you are encouraged to explore and see what fits your taste, while building your career :)
### Web development vs. web design
-You might have heard these terms used interchangeably. They are, however, two different things. A web developer writes code and handles the logical, technical side. A web designer decides how things are going to look and handle the creative side. The following video will explain this more clearly:
+You might have heard these terms used interchangeably. They are, however, two different things. A web developer writes code and handles the logical, technical side. A web designer decides how things are going to look and handles the creative side. The following video will explain this more clearly:
-[Web Developer vs. Web Designer](https://www.youtube.com/watch?v=M-M7jBV_Gf4)
+[Web Developer vs. Web Designer](https://www.youtube.com/watch?v=bDtxF7qSofg)
### Websites vs. web applications
Before we get started with the meat of the module (which is JavaScript), we need to make a small but important distinction: are we going to make websites or web applications? For non-developers, there is no difference but for you as a developer you must know what it is that you'll be producing.
-The difference between a website and a web application is the difference between [Wikipedia](https://www.wikipedia.org) and [Facebook](https://wwww.facebook.com). In Facebook, the data shown changes depending on the user. If you are logged in, you'll see different things than that I will. However, on Wikipedia the information will always be the same, for both you and me.
+The difference between a website and a web application is the difference between [Wikipedia](https://www.wikipedia.org) and [Facebook](https://wwww.facebook.com). In Facebook, the data shown changes depending on the user. If you are logged in, you'll see different things than that I will. However, on Wikipedia the information will always be the same, for both you and me.
-In other words, we're talking about `static` versus `dynamic` sites: a static site always has the same information and serves only to be information, while a dynamic site changes the data shown to the user depending on who it is and what their interactivity on the page is.
+In other words, we're talking about `static`(= website) versus `dynamic` (= application) sites: a static site always has the same information and serves only to be information, while a dynamic site changes the data shown to the user depending on who it is and what their interactivity on the page is.
Read the following articles to learn more about this:
@@ -100,7 +114,9 @@ Read the following articles to learn more about this:
JavaScript is a programming language. We use it to communicate with the browser, software that allows us to access the Internet and open webpages. It is essential to learn in order to become a web developer.
-You've already learned what HTML and CSS do. Javascript is the third part that makes the circle complete. If we liken the three to the human body, we could say that HTML provides the skeleton, CSS provides the skin and shape, and JavaScript provides the animation/interactivity.
+You've already learned what HTML and CSS do. Javascript is the third part that makes the circle complete. If we liken the three to the human body, we could say that HTML provides the skeleton with all the basic content, CSS makes the skin/shape to determine the look, and JavaScript is the brain and muscles to allow for interactivity.
+
+
The main use for JavaScript is to make your webpage interactive: for example, if you click a button it will open a popup. Or if you scroll over an image, it changes its color.
@@ -111,38 +127,58 @@ Check the following resources to learn more about it:
## 4. What are variables?
-A variable is a piece of information that is saved. You give it a name that describes what its contents are, and to also refer to it at a later point.
+A `variable` is a box that contains a piece of information, to be saved for later use. You give it a name that describes what its contents are, and to also refer to it at a later point.
+
+- [Beginner Programming Concepts - What's a Variable?
+ ](https://www.youtube.com/watch?v=Jvrszgiexg0)
### The keywords: let, const, var
-The variable is a central concept within programming. It's applied the same way across almost all programming languages. In JavaScript we apply it by using a `keyword`, a word that is reserved by the language because it has a special meaning. Read more about this in the following article:
+The concept of a `variable` is a central concept within programming. It's applied the same way across almost all programming languages. In JavaScript we apply it by using a special `keyword`, a word that is reserved by the language because it has a special meaning.
+
+The keywords are `var`, `let` and `const`.
+
+Read more about this in the following article:
- [Variables](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/variables.md)
-A variable always contains a `value`: a piece of information that you want to refer to at a later stage. Read more about this here:
+A variable always contains a `value`: the piece of information that you want to save and refer to at a later stage. Read more about this here:
- [Values](https://www.github.com/hackyourfuture/fundamentals/blob/master/fundamentals/values.md)
-When creating variables, it's important to think about the right name to give it. It should always reflect what "type" of data it contains and how it would make sense in light of the rest of your code. You (and other developers that will read your code) should be able to read a variable name and know what its purpose is.
+When creating variables, it's important to think about the right name to give it. It should always reflect what "type" of data it contains and what its purpose is. You (and other developers that will read your code) should be able to read a variable name and know what its purpose is.
-Why do we need variables? You'll be using variables to manipulate its content (the value inside the variable). Why would you want to do this? For most of the time, you want to perform some kind of calculation. The most basic example is the following:
+Why do we need variables? You'll be using variables **to manipulate its content** (the value inside the variable). Why would you want to do this? For most of the time, you want to perform some kind of calculation. The most basic example is the following:
```js
const one = 1;
const two = one + one;
```
-Here we have assigned to a new variable the calculation `one` plus `one`. Why have we put the end result into a new variable? It is because the result of the calculation will not be remembered later down the line of code, so we store it in a variable in case we want to manipulate that some point later.
+Here we have assigned to a new variable the calculation `one` plus `one`. Why have we put the end result into a new variable? It is because the result of the calculation will **not be remembered** later. Memory works differently in computers: after a calculation is finished a computer thinks its job is done. The result will not exist after, unless explicitly captured within a variable.
This is something that you will learn when you start coding yourself. If you can't wait you can already look at the [homework](./MAKEME.md).
## 5. What are data types?
-A data type is a category of data. It tells the code interpreter what kind of data it is reading so it knows how to optimally store it in memory. An example of this is the Number type. In most programming languages, when it reads the number `2` it doesn't know that it's a number. It needs to be told it is so. In JavaScript, however, that is assumed.
+A data type is a category of data. It tells the code interpreter what kind of data it is reading so it knows how to process and optimally store it in memory.
+
+An example of this is the `Number` type. In most programming languages, when it reads the number `2` it doesn't know that it's a number. It needs to be told that the character `2` is of the `Number` data type.
## 6 Basic types
-There are about 6 basic data types in JavaScript. String, Number, Boolean, Object, Array, and Function. You can read more about them in the following article:
+There are about `6 basic data types` in JavaScript:
+
+- `String`
+- `Number`
+- `Boolean`
+- `Object`
+- `Array`
+- `Function`
+
+A data type, or data structure, is a way of organizing information. Computers need to know how to look at any piece of information, and it can interpret it only if it fits into one of the aforementioned data types.
+
+You can read more about them in the following article:
- [JavaScript Data Types](https://www.tutorialrepublic.com/javascript-tutorial/javascript-data-types.php)
- [JS Data Types](https://www.w3schools.com/js/js_datatypes.asp)
diff --git a/Week2/LESSONPLAN.md b/Week2/LESSONPLAN.md
index ebe0a6342..25a10f1eb 100644
--- a/Week2/LESSONPLAN.md
+++ b/Week2/LESSONPLAN.md
@@ -11,31 +11,47 @@ The purpose of this class is to introduce to the student:
## Core concepts
-FIRST HALF (12.00 - 13.30)
+FIRST HALF (12.05 - 13.30)
-### 1. Q&A about last week's concepts & homework
-(Add more content)
+## 1. Q&A about last week's concepts & homework
-### 2. The difference between statements & expressions
-##### Explanation
-An expression is a piece of code that resolves in a value (becomes a value)
+### Explanation
+
+- static vs. dynamic websites
+- Variables in JavaScript: `var`, `let`, `const`, declaration, initialization, assignment
+- Basic Data Types in JavaScript: `number`, `string`, `boolean`, `undefined`, `null`
+- Compound Data Types in JavaScript: `array`, `object`
+
+### Exercise
+
+Let the students explain the concepts themselves.
+
+## 2. The difference between statements & expressions
+
+### Explanation
+
+An expression is a piece of code that resolves to a value (becomes a value)
A statement is an instruction
-##### Example
-###### Expressions
-* `sum(a, b)`
-* `a`
-* `a > 4 ? "yes" : "no"`
-* `a + b`
-* `a && b || c`
+### Example
+
+#### Expressions
-###### statements
-* `let x;`
-* `if (a > 4) { return "yes"; } else { return "no"; }`
-##### Exercise
+- `sum(a, b)`
+- `a`
+- `a > 4 ? "yes" : "no"`
+- `a + b`
+- `a && b || c`
-###### 15. Indicate for each of these whether it is an expression or a statement:
+#### statements
+
+- `let x;`
+- `if (a > 4) { console.log("larger than 4"); } else { console.log("not larger than 4"); }`
+
+### Exercise
+
+#### Indicate for each of these whether it is an expression or a statement:
1. `l`
2. `l = 4;`
@@ -47,88 +63,109 @@ A statement is an instruction
8. `function a() { return 4; }`
9. `let a = function () { return 4; }`
-###### Given the following code:
+#### Given the following code:
```js
-let s = "Hello".toLowerCase();
+let s = 'Hello'.toLowerCase();
let l = s.length;
function sum(a, b) {
return a + b;
}
-let max = function (a, b) {
+let max = function(a, b) {
return a > b ? a : b;
-}
+};
let s1 = sum(4, 5);
let s2 = 4 + 5;
if (s2 == s1) {
- console.log("same");
+ console.log('same');
} else {
- console.log("not same");
+ console.log('not same');
}
```
-List all 11 *statements* in the code above
-List all 28 *expressions* in the code above (BONUS!)
+List 5 statements from all 11 _statements_ in the code above
+
+List 5 expressions of all 28 _expressions_ in the code above (BONUS!)
+
+### Essence
-##### Essence
It's important to know the difference between expressions and statement because:
- 1. It will give you an overview on what the code is about (is it an instruction or is code that resolves in a value)
- 2. While writing code you'll not mix up the two and therefore make sure that you do not write wrong code.
-
-
-### 3. What are operators (comparison, arithmetic, logical, assignment)
-##### Explanation
-An operator is capable of manipulating a certain value or operand. Operators are used to perform specific mathematical and logical computations on operands. In other words, we can say that an operator operates the operands. In JavaScript operators are used for compare values, perform arithmetic operations etc. There are various operators supported by JavaScript:
-
-* Arithmetic Operators
- take numerical values (either literals or variables) as their operands and return a single numerical value.
-* Comparison Operators
- Two diferent types of comparison operators; They will always return a logical value,
-- Equality Operators
- checks if the operands are 'the same'
- diffference in '=' '==' '==='
-- Relational Operators
- checks if the specific relation between two operands is true or false
-
-* Logical Operators
- Mostly 'comparing'boolean values, but it can be used with any type.
-
-* Assignment Operators
-assigns a value to its left operand based on the value of its right operand. The simple assignment operator is equal '='
-
-(https://www.geeksforgeeks.org/javascript-operators/)
-##### Example
+
+1. It will give you an overview on what the code is about (is it an instruction or is code that resolves to a value)
+2. While writing code you'll not mix up the two and therefore make sure that you do not write wrong code.
+
+## 3. What are operators (comparison, arithmetic, logical, assignment)
+
+### Explanation
+
+- Arithmetic Operators
+ - take numerical values (either literals or variables) as their operands and return a single numerical value.
+ - `19 + 13`, `126 / 3`, `397 % 71`
+- Comparison Operators
+ - Two different types of comparison operators; They will always return a logical value,
+ - Equality Operators
+ - checks if the operands are 'the same'
+ - difference in '=' '==' '==='
+ - Relational Operators
+ - checks if the specific relation between two operands is true or false
+ - `>`, `<`, `<=`, `>=`
+
+
+- Logical Operators
+ - Mostly 'comparing' boolean values, but it can be used with any type.
+ - `true || false`, `false && true`, `!true`
+
+- Assignment Operators
+ - assigns a value to its left operand based on the value of its right operand. The simple assignment operator is equal '='
+ - `+=`, `-=`, `*=`, `/=`
+
+(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators)
+
+### Example
+
https://www.tutorialsteacher.com/javascript/javascript-operators
-##### Exercise
+
+### Exercise
+
See example
-##### Essence
-Operators are very important in a programming language, because this is how we manipulate values.
-In fact, operators are the buildingblocks of all possible actions.
+### Essence
+Operators are very important in a programming language, because this is how we manipulate values.
+In fact, operators are the building blocks of all possible actions.
SECOND HALF (14.00 - 16.00)
-### 4. What are loops (do/while & for loop)
-##### Explanation
-Programming loops are about doing the same thing over and over again. Another term for that is: iteration
+## 4. What are loops (do/while & for loop)
+
+### Explanation
+
+Programming loops are about doing the same thing over and over again, without typing the code over and over again. Another term for that is: iteration
Wikipedia: In most computer programming languages, a while loop is a (control flow) statement that allows (a block of) code to be executed repeatedly based on a given Boolean condition.
-##### Example
-*images*
-##### Exercise
+### Example
+
+```javascript
+```
+
+### Exercise
+
Make a for loop with a do-while loop
-##### Essence
-In programming you have to do a lot of (alomst) similar calculations over and over again. Using loops makes it iesier (and less boring) to code. Next to that it makes sure the the code is much more compact.
+
+### Essence
+
+In programming you have to do a lot of (almost) similar calculations over and over again. Using loops makes it easier (and less boring) to code. Next to that it makes sure the the code is much more compact.
You can check: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Looping_code as well. underneath the paragraph: 'Why bother'
-5. What are conditional statements (if/else & switch)
-##### Explanation
+## 5. What are conditional statements (if/else & switch)
+
+### Explanation
+
The normal order of execution of statements in a computer program is in straight-line order, from top to bottom. However, sometimes it is desirable to execute one or more statements conditionally, i.e. depending on whether some condition – determined by the state of your program – holds true (Boolean expression).
In its simplest form the `if` statement looks like this:
@@ -138,32 +175,88 @@ if () {
}
```
-Then we have:
+Then we have:
+
```js
if() {
} else {
}
```
+
At last we have:
+
```js
if() {
} else if {
}
```
-The switch statement can sometimes be a useful alternative to a concatenation of if statements. This is the case when the condition is an expression that can be decomposed into a number of distinct values or cases, as shown in the example below.
+The switch statement can sometimes be a useful alternative to a long list of if statements. This is the case when the condition is an expression that can be decomposed into a number of distinct values or cases, as shown in the example below.
+Depending on the value of the expression specified in the `switch` clause, one of the `case` statement blocks is executed. Each statement block should end with a `break` statement to ensure that a `case` doesn't 'fall through' into the next `case`.
+
+The `default` statement at the end is executed when none of the preceding cases hold true. The `default` statement is not strictly required, but is a best practice to always specify one.
+
+### Example
-##### Example
```js
if (distance < 10) {
- console.log('I will take the bike.');
+ console.log('I will take the bike.');
}
```
+```js
+const hyfModule = 'JavaScript-1';
+let message = '';
+
+switch (hyfModule) {
+ case 'HTML/CSS':
+ message = 'In this module you will learn HTML and CSS.';
+ break;
+ case 'JavaScript-1':
+ message = 'In this module you will learn Git and JavaScript basics.';
+ break;
+ case 'JavaScript-2':
+ message = 'In this module you will learn about JavaScript in the browser with HTML and CSS.';
+ break;
+ case 'JavaScript-3':
+ message = 'In this module you will learn about Async and API calls.';
+ break;
+ case 'Node':
+ message = 'This module is about building server and CLI applications using Node.';
+ break;
+ case 'Database':
+ message = 'In this module is about Relational and Non-Relational Data and Database Systems.';
+ break;
+ case 'React':
+ message = 'In this module you will to build Single Page Applications using React.';
+ break;
+ case 'Project':
+ message = 'In this final module you will do your graduation project.';
+ break;
+ default:
+ message = 'This module is unknown: ' + hyfModule;
+}
+
+console.log(message);
+```
-##### Exercise
-https://developer.mozilla.org/nl/docs/Web/JavaScript/Reference/Statements/if...else
+### Exercise
+Create a Switch/Case that will log the season based on the month.
-##### Essence
+```javascript
+const month = 'January';
+let season = '';
+
+switch (month) {
+ case 'January':
+ season = 'winter';
+ break;
+}
+
+console.log(season); // 'winter'
+```
+
+https://developer.mozilla.org/nl/docs/Web/JavaScript/Reference/Statements/if...else
+### Essence
diff --git a/Week2/MAKEME.md b/Week2/MAKEME.md
index 9690a4c91..abc8df3da 100644
--- a/Week2/MAKEME.md
+++ b/Week2/MAKEME.md
@@ -9,10 +9,10 @@
## **1. Practice the concepts**
-In this section you will be doing interactice exercises, that will allow you to practice with the concepts you've learned about this week!
+In this section you will be doing interactive exercises, that will allow you to practice with the concepts you've learned about this week!
-- [Codecademy: Arrays](https://www.codecademy.com/courses/introduction-to-javascript/lessons/arrays)
-- [FreeCodeCamp: Basic data structures](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures)
+- Do all parts of [Codecademy: Arrays](https://www.codecademy.com/courses/introduction-to-javascript/lessons/arrays) (Signup required!)
+- Do 5 exercises of [FreeCodeCamp: Basic data structures](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures)
## **2. JavaScript exercises**
@@ -30,11 +30,15 @@ Consider the following string:
let myString = 'hello,this,is,a,difficult,to,read,sentence';
```
+Follow the steps:
+
1. Add the variable to your file.
2. Log the length of `myString`.
3. The commas make that the sentence is quite hard to read. Find a way to remove the commas from the string and replace them with spaces. (use Google!)
4. After replacing the commas, log `myString` to see if you succeeded.
+Expected result in the console: `hello this is a difficult to read sentence`
+
**Exercise 2: The even/odd reporter**
Report whether or not a number is odd/even!
@@ -48,25 +52,24 @@ Report whether or not a number is odd/even!
Ever wondered how to make a certain meal? Let's create a recipe list with JavaScript!
-1. Declare a variable that holds an object (your meal recipe).
+1. Declare a variable that holds an empty object literal (your meal recipe).
2. Give the object 3 properties: a `title` (string), a `servings` (number) and an `ingredients` (array of strings) property.
-3. Log each property out seperately, using a loop (for, while or do/while)
+3. Log each property out separately, using a loop (for, while or do/while)
-It should look similar to this:
+Expected result:
-```markdown
-Meal name: Omelete
+```console
+Meal name: Omelette
Serves: 2
-Ingredients:
-4 eggs
-2 strips of bacon
-1 tsp salt/pepper
+Ingredients: 4 eggs, 2 strips of bacon, 1 tsp salt/pepper
```
**Exercise 4: The reading list**
Keep track of which books you read and which books you want to read!
+Follow the steps:
+
1. Declare a variable that holds an array of 3 objects, where each object describes a book and has properties for the `title` (string), `author` (string), and `alreadyRead` (boolean indicating if you read it yet).
2. Loop through the array of books.
3. For each book, log the book title and book author like so: "The Hobbit by J.R.R. Tolkien".
@@ -86,17 +89,27 @@ const drinkTypes = ['cola', 'lemonade', 'water'];
```
2. Create a loop that runs 5 times. On each iteration, push a drink into the `drinkTray` variable. The `drinkTray` can only hold at most two instances of the same drink type, for example it can only hold 2 colas, 2 lemonades, 2 waters.
+
+```js
+// Expected result:
+const drinkTray = ['cola', 'cola', 'lemonade', 'lemonade', 'water'];
+
+// 'Hey guys, I brought a cola, cola, lemonade, lemonade, water!'
+```
+
3. If there are already two instances of a `drinkType` then start with the next drink in the array.
4. Your `drinkTray` should contain 2 cola, 2 lemonade and 1 water.
5. Log to the console: "Hey guys, I brought a [INSERT VALUES FROM ARRAY]!" (For example: "Hey guys, I brought a cola, cola, lemonade, lemonade, water!")
+Test out your code using `node` in the command line!
+
## **3. Code along**
-> Create a new folder outside of your `JavaScript1` fork
+> Create a new GitHub repository for each of these projects. They are portfolio pieces!
In the following 2 projects you'll be flexing your HTML/CSS skills again, together with writing JavaScript code. They are similar in structure and logic, so be sure to spot the similarities!
-It's ok if you don't understand exactly what's happening here. Just follow along and try to understand: ask questions about what the developer is doing and think about every line of code.
+It's ok if you don't understand exactly what's happening here. Just follow along and try to understand: ask yourself questions about what the developer is doing and think about every line of code.
**Project 1: Temperature Converter**
@@ -119,13 +132,19 @@ In order to speed up development you'll be using a CSS framework: [Bootstrap 4](
> 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.
-In this project you'll write a script that calculates grades, based on the American grading system! Let's say a student did a test and they got a 60 out of 100, this script will:
+In this project you'll write a `function` that calculates grades, based on the American grading system! Let's say a student did a test and they got a 60 out of 100, this `function` will:
1. convert the score into a percentage
2. calculate what grade corresponds with that percentage, and
3. shows in the command line the result: the grade and the percentage
-When writing the script, make use of the following grade scores:
+In this example this is what we would expect the `function` to return in the command line:
+
+```markdown
+You got a D (60%)!
+```
+
+When writing the `function`, make use of the following grade scores:
```markdown
Grade A (90% - 100%)
@@ -144,12 +163,6 @@ These are the requirements your project needs to fulfill:
- Make the return value of the function a template string, so you can insert variables!
- Use `node` from the command line to test if your code works as expected
-This is what the script is expected to return in the command line:
-
-```markdown
-You got a B (85%)!
-```
-
Good luck!
## **SUBMIT YOUR HOMEWORK!**
@@ -159,7 +172,7 @@ After you've finished your todo list it's time to show us what you got! The home
1. JavaScript exercises
2. PROJECT: Grade calculator
-Upload both to your forked JavaScript1 repository in GitHub. Make a pull request to the original repository.
+Upload both to your JavaScript1 repository forked to your personal account in GitHub. Make a pull request to the [HackYourHomework/JavaScript1](https://www.github.com/hackyourhomework/javascript1).
> Forgotten how to upload your homework? Go through the [guide](../hand-in-homework-guide.md) to learn how to do this again.
diff --git a/Week2/README.md b/Week2/README.md
index af0ca5eb2..c9a882e9c 100644
--- a/Week2/README.md
+++ b/Week2/README.md
@@ -11,6 +11,12 @@ These are the topics for week 2:
5. Conditional statement
6. Naming conventions
+## 0. Video Lectures
+
+Your teacher Uday has made video lectures for this week's material. You can find them here: [Videos 11 - 20](https://www.youtube.com/playlist?list=PLVYDhqbgYpYUiqH8IxLJ5qomkEGMzes1q)
+
+
+
## 1. Statements vs. Expressions
A lot of programming is nothing different from regular human communication. When conversing with another person, we often use language in various ways: to ask questions, make statements or simply express yourself about what's going on.
@@ -19,14 +25,16 @@ This is the same in programming. A difference is that it's done in abstract code
To learn more about statements vs. expression, research the following resources:
-- [Statements vs. Expressions](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/statements_expressions.md)
- [Expressions vs. Statements in JS](https://www.youtube.com/watch?v=WVyCrI1cHi8)
+- [Statements vs. Expressions](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/statements_expressions.md)
## 2. Loops
-A loop is a sequence of instructions that is continually repeated until a certain condition is fulfilled. This condition could either be a specified number or when a desired value is found.
+A loop is a sequence of instructions that is continually repeated until a certain condition is fulfilled. This condition could either be a specified number or when a desired value is found or not.
+
+In programming, a loop is meant to be used in case there's a repetitive task that needs to be done.
-Read more about loops here:
+Learn more about loops here:
- [JavaScript Loops](https://www.youtube.com/watch?v=s9wW2PpJsmQ)
- [Loops](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/loops.md)
@@ -39,10 +47,11 @@ In the language of JavaScript this goes from top to bottom, left to right. This
> The term `flow` is a general term meaning a specific, repeatable order of actions. In your working life you'll hear the term `workflow`, which in that case refers to the different actions necessary to complete a business activity.
-There is one important distinction between spoken language and programming languages: in programming languages the order in which the code is read can change, depending on various `control statements`.
+There is one important distinction between spoken language and programming languages: in programming languages the order in which the code is read can change, depending on various `control statements` (`if`, `for/while/do-while loop` or `switch`).
Learn more about control flow here:
+- [Introduction to Programming - Control Flow](https://www.youtube.com/watch?v=nBj2nJup8xU)
- [Control flow](https://dev.to/mugas/control-flow-in-javascript-246l)
## 4. Operators
@@ -60,10 +69,11 @@ Computers only function by logical rules: whether something is true or not deter
```js
if () {
+ // then this will happen
}
```
-A condition is put in the `( )` and it needs to evaluate to `true` or `false` (also known as Boolean values). If the condition is true, then whatever is inside the `{ }` will be executed.
+A condition is put in the `( )` and it needs to evaluate to `true` or `false` (also known as `Boolean` values). If the condition is true, then whatever is inside the `{ }` will be executed.
What happens when the condition is false? For that we have the `else { }` block. If the condition is false, then whatever is inside the else will be executed:
@@ -82,6 +92,7 @@ A naming convention is a rule that every developer should hold themselves to whe
Read about the different naming conventions for JavaScript here:
+- [Naming Conventions in Programming](https://blog.jsecademy.com/naming-conventions-in-programming/)
- [Naming conventions](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/naming_conventions.md)
## Finished?
diff --git a/Week3/LESSONPLAN.md b/Week3/LESSONPLAN.md
index c03c7d215..50a1ce2f7 100644
--- a/Week3/LESSONPLAN.md
+++ b/Week3/LESSONPLAN.md
@@ -14,19 +14,9 @@ FIRST HALF (12.00 - 13.30)
## 1. Q&A about last week's concepts & homework
-### Explanation
-**Week 1**
-
-In Week 1 we learnt about how data is represented computer programs:
-
- Variables
- Basic data types (`string`, `number`, etc)
- Compound data types (`array`, `object`)
-
-**Week 2**
-
-In Week 2 we learnt about how to manipulate the flow of execution in computer programs:
-
- Branching constructs
- `if..else`
- Looping constructs
@@ -34,17 +24,11 @@ In Week 2 we learnt about how to manipulate the flow of execution in computer pr
- `for..of`
- `for..in`
- `do..while`
-
-We also learnt about more ways to work with data using operators:
-
- Operators (arithmetic, comparison, eg `+`, `*`, `&&`, `||`, etc).
-### Example
-### Exercise
-Ask students to explain a concept or summerise the last lecture themselves
-### Essence
+Note: You can ask students to explain a concept or summerise the last lecture themselves
-## 2. What is a function (ES5 only)
+## 2. Function (ES5 only)
### Explanation
Functions are a way to organize your code in to re-usable chunks.
@@ -57,7 +41,7 @@ https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/function
### Example
Same link as Explanation
### Exercise
-https://github.com/yash-kapila/HYF-JS1-Week3/tree/master/src
+
### Essence
- __Reusability__: Functions can be grouped together to make a module (or library), and then modules can be imported into your application so you can build awesome apps!
- __Abstraction__: Hide underlying details about how a piece of functionality works under the hood. You can change how things are implemented within the function without other programmers who use your function worrying aobut the exact details of how it was implemented.
@@ -66,15 +50,27 @@ And the same link as Explanation
SECOND HALF (14.00 - 16.00)
-## 3. Wat is scope (global, functional, block)
+## 3. Scope (global, functional, block)
### Explanation
Scopes define the visiblity of declarations of variables and functions.
-The top level outside all your functions is called the _global scope_. Values defined in the global scope are accessible from everywhere in the code.
+The top level outside all your functions is called the _global scope_. Values defined in the global scope are accessible from everywhere in the code. Whereas, variables defined in local scope can only be accessed and altered inside the scope they were created.
- `var` and `function` declarations are visible with function scope.
-- `let` and `const` declarations are visible with block scope.
+- `let` and `const` declarations are visible with block scope. A block can be seen as a set of statements enclosed in curly brackets({}).
+
+Global scope:
+
+- Can be a real useful tool or a nightmare.
+- Useful in scenarios where we want to export JS modules, use third party libraries like jQuery etc.
+- Big risk of causing namespace clashes with multiple variables with same name being created in different places.
+
+Local Scope:
+
+- Think of local scope as any new scope that is created within the global scope.
+- Each function written in JavaScript creates a new local scope.
+- Variables defined within a function aren't available outside it. They are created when a function starts and are _in a way_ destroyed/hidden when a function ends.
https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/scope.md
### Example
@@ -124,6 +120,7 @@ Same link as Explanation
### Explanation
### Example
### Exercise
+https://github.com/yash-kapila/HYF-JS1-Week3/tree/master/src
### Essence
_Special thanks to Jim Cramer, Yash Kapila, David Nudge for most of the content_
diff --git a/Week3/MAKEME.md b/Week3/MAKEME.md
index f32e7c5dd..d76dc7c0e 100644
--- a/Week3/MAKEME.md
+++ b/Week3/MAKEME.md
@@ -33,65 +33,110 @@ There is no better way to start your day then with a compliment!
1. Write a function named `giveCompliment`
- It takes 1 argument: your name
-- Inside the function create an array with 10 strings. Each string should be a compliment, like `"great"`, `"awesome"`
-- Write logic that randomly selects a compliment
+- Inside the function define a variable that holds an array, `compliments`, with 10 strings. Each string should be a compliment, like `"great"`, `"awesome"`
+- Write code that randomly selects a compliment
- Return a string: "You are [COMPLIMENT], [YOUR_NAME]!
2. Call the function three times, giving each function call the same argument: your name.
+```js
+// Expected output
+giveCompliment('Noer'); // Returns "You are amazing, Noer!"
+giveCompliment('Noer'); // Returns "You are great, Noer!"
+giveCompliment('Noer'); // Returns "You are supersmart, Noer!"
+```
+
**Exercise 2: Dog years**
-You know how old your dog is in human years, but what about dog years? Calculate it!
+You know how old your dog is in human years, but what about dog years? Let's calculate it!
1. Write a function named `calculateDogAge`.
-- It takes 1 argument: your puppy's age (number).
-- Calculate your dog's age based on the conversion rate of 1 human year to 7 dog years.
+- It takes 1 argument: your (fictional) puppy's age (number).
+- Calculate your dog's age based on the conversion rate of `1 human year to 7 dog years`.
- Return a string: "Your doggie is [CALCULATED_VALUE] years old in dog years!"
2. Call the function three times with different sets of values.
+```js
+// Expected output
+calculateDogAge(1); // Returns "Your doggie is 7 years old in dog years!"
+calculateDogAge(2); // Returns "Your doggie is 14 years old in dog years!"
+calculateDogAge(3); // Returns "Your doggie is 21 years old in dog years!"
+```
+
**Exercise 3: Be your own fortune teller**
Why pay a fortune teller when you can just program your fortune yourself?
-1. Write a function named `tellFortune`.
+1. Create 4 arrays, `numChildren`, `partnerNames`, `locations` and `jobs`. Give each array 5 random string values that have to do with the name of the variable
+2. Write a function named `tellFortune`.
- It takes 4 arguments: number of children (number), partner's name (string), geographic location (string), job title (string).
- Randomly select values from the arrays.
-- Return a string: "You will be a [JOB_TITLE] in [LOCATION], and married to [PARTNER_NAME] with [NUMBER_KIDS] kids."
+- Return a string: "You will be a [JOB_TITLE] in [LOCATION], married to [PARTNER_NAME] with [NUMBER_KIDS] kids."
+
+3. Call the function 3 times, by passing the arrays as the argument.
-2. Create 4 arrays, `numChildren`, `partnerNames`, `locations` and `jobs`. Give each array 5 random values that make sense
-3. Call the function 1 time, by passing the arrays as the argument.
+```js
+// Expected output
+const numChildren = [...];
+const partnerNames = [...];
+const locations = [...];
+const jobs = [...];
+
+tellFortune(numChildren, partnerNames, locations, jobs); // Returns "You will be a programmer in The Netherlands, married to Layla with 3 kids."
+tellFortune(numChildren, partnerNames, locations, jobs); // Returns "You will be a farmer in France, married to Muhammed with 2 kids."
+tellFortune(numChildren, partnerNames, locations, jobs); // Returns "You will be a teacher in The United States, married to Zara with 4 kids."
+```
**Exercise 4: Shopping at the supermarket**
Let's do some grocery shopping! We're going to get some things to cook dinner with. However, you like to spend your money and always buy too many things. So when you have more than 3 items in your shopping cart the first item gets taken out.
-1. Write a function named `addToShoppingCart`.
+1. Create an array called `shoppingCart` that holds the following strings: `"bananas"` and `"milk"`
+2. Write a function named `addToShoppingCart`
-- It takes in 1 argument: a grocery item (string)
-- Add grocery item to array. If the amount of items is more than 3 remove the first one in the array
+- It takes 1 argument: a grocery item (string)
+- Add grocery item to `shoppingCart`. If the amount of items is more than 3 remove the first one in the array
+- Loops through the array in order to list out the items
- Return a string: "You bought [LIST_OF_GROCERY_ITEMS]!"
-2. Create an array with 2 predefined strings: `"bananas"` and `"milk"`
3. Call the function 3 times, each time with a different string as the argument.
+```js
+const shoppingCart = ['bananas', 'milk'];
+
+// Expected output
+addToShoppingCart('chocolate'); // Returns "You bought bananas, milk, chocolate!"
+addToShoppingCart('waffles'); // Returns "You bought milk, chocolate, waffles!"
+addToShoppingCart('tea'); // Returns "You bought chocolate, waffles, tea!"
+```
+
**Exercise 5: Total cost is ...**
-You want to buy a couple of things from the supermarket to prepare for a party. After scanning all the items the cashier gives you the total price, but the machine a broken! Let's write her a function that does it for her instead!
+You want to buy a couple of things from the supermarket to prepare for a party. After scanning all the items the cashier wants to give you the total price, but the machine is broken! Let's write her a `function` that does it for her instead!
-1. Write a function called `calculateTotalPrice`
+1. Create an object named `cartForParty` with 5 properties. Each property should be a grocery item (like `beers` or `chips`) and hold a number value (like `1.75` or `0.99`)
+2. Write a function called `calculateTotalPrice`
- It takes 1 argument: an object that contains properties that only contain number values
-- Add all the number values together
-- Return a number: the total price of all items
+- Loop through the object and add all the number values together
+- Return a string: "Total: €[TOTAL_PRICE_ITEMS]"
-2. Create an object named `cartForParty` with 5 properties. Each property should be a grocery item (like `beers` or `chips`) and hold a number value (like `1.75` or `0.99`)
3. Call the function 1 time, giving it the object `cartForParty` as an argument
+```js
+const cartForParty = { ... }
+
+// Expected output
+calculateTotalPrice(cartForParty); // Returns "Total: €10.75"
+```
+
## **3. Code along**
+> Create a new GitHub repository for this project. It's a portfolio piece!
+
In this project you'll be building a simple meditation application, that will allow you to set a timer, loop a video and play a song!
You'll be working with the