Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Here you can find course content and homework for the JavaScript 1,2 and 3 modul
|Week|Topic|Read|Homework|Review|
|----|-----|----|--------|------|
|0.|Preparation for your first JavaScript session|[Pre-reading](https://github.com/HackYourFuture/JavaScript/tree/master/Week0) + [CLI Reading Week 1](https://github.com/HackYourFuture/CommandLine/blob/master/Lecture-1.md)|-|
|1.|• [CLI](https://github.com/HackYourFuture/CommandLine) session with Unmesh :heart: <br>• Intro JavaScript (What is it, where can you use it for)<br>• Variables [var, let, const]<br>• Basic Data types [Strings, Numbers, Arrays]<br>• Operators|[Reading Week 1](https://github.com/HackYourFuture/JavaScript/tree/master/Week1/README.md) | [Homework Week 1](https://github.com/HackYourFuture/JavaScript/tree/master/Week1/MAKEME.md)|[Review](https://github.com/HackYourFuture/JavaScript/blob/master/Week1/REVIEW.md)|
|1.|• [CLI](https://github.com/HackYourFuture/CommandLine) session with Unmesh :heart: <br>• Intro JavaScript (What is it, where can you use it for)<br>• Variables [var, let, const]<br>• Basic Data types [Strings, Numbers, Arrays, Booleans]<br>• Operators|[Reading Week 1](https://github.com/HackYourFuture/JavaScript/tree/master/Week1/README.md) | [Homework Week 1](https://github.com/HackYourFuture/JavaScript/tree/master/Week1/MAKEME.md)|[Review](https://github.com/HackYourFuture/JavaScript/blob/master/Week1/REVIEW.md)|
|2.|• Advanced data types [Objects] <br>• Conditions <br>• Statements vs Expressions<br> • Loops (for/while)<br>• Functions <br>• Naming conventions|[Reading Week 2](https://github.com/HackYourFuture/JavaScript/tree/master/Week2/README.md)|[Homework Week 2](https://github.com/HackYourFuture/JavaScript/tree/master/Week2/MAKEME.md)|[Review](https://github.com/HackYourFuture/JavaScript/blob/master/Week2/REVIEW.md)|
|3.|• [CLI](https://github.com/HackYourFuture/CommandLine) session with Unmesh :balloon: <br>• Closures <br>• Scope <br>• Array Manipulations <br>• Basic DOM manipulations [img src, innerHTML]<br>• Code commenting|[Reading Week 3](https://github.com/HackYourFuture/JavaScript/tree/master/Week3)|[Homework Week 3](https://github.com/HackYourFuture/JavaScript/tree/master/Week3/MAKEME.md)|[Review](https://github.com/HackYourFuture/JavaScript/blob/master/Week3/REVIEW.md)|
|4.|• JSON<br>• Code debugging using the browser<br>• Functions + JSON/Arrays<br>• Code flow (order of execution) <br>• (capturing user input) <br>• Structuring code files|[Reading Week 4](https://github.com/HackYourFuture/JavaScript/tree/master/Week4)|[JS](https://github.com/HackYourFuture/JavaScript/tree/master/Week4/MAKEME.md) + [Git Homework Week 4](https://github.com/HackYourFuture/Git/blob/master/Lecture-1.md)|Review|
Expand Down
5 changes: 5 additions & 0 deletions Week0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ In week one we will discuss the following topics:
• Operators
```


## How to get started
1. Download and install the latest Current version of NodeJS - from https://nodejs.org/en/download/current/
To test that it was installed and running properly, go to your terminal and run the command: node -v You should get the node version printed on your terminal, for example, v8.8.0

### Here are resources that we like you to read as a preparation for the coming lecture:

Please watch the following parts of the course, [Programming Foundations Fundamentals](https://www.lynda.com/Programming-Foundations-tutorials/Welcome/83603/90426-4.html) on Lynda.com (if you don't have access to Lynda yet ask Gijs):
Expand Down
108 changes: 90 additions & 18 deletions Week1/MAKEME.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

>[Here](https://github.com/HackYourFuture/JavaScript/tree/master/Week1/README.md) you find the readings you have to complete before the second lecture.

We covered a bit of command line usage in the first class and got a program running which is great. If you need a refresher for the command line please have a look here: https://github.com/HackYourFuture/CommandLine

## Before you start with the homework:

1. Watch: [What is programming](https://www.khanacademy.org/computing/computer-programming/programming/intro-to-programming/v/programming-intro) Just watch the 2 min video, you do not have to do the entire JavaScript course (It could be useful later on though).
Expand All @@ -15,6 +13,8 @@ We covered a bit of command line usage in the first class and got a program runn

## Step 1: Command Line

>We covered a bit of command line usage in the first class and got a program running which is great. If you need a refresher for the command line please have a look here: https://github.com/HackYourFuture/CommandLine

1. Create a `.js` file that prints `Hello` when you run it from the command line. (Hint: `node` is the program that can run your JavaScript files.)

```
Expand All @@ -35,33 +35,105 @@ Write commands to do following:

## Step 2: JavaScript

> For all the following exercises create a new .js file. Try to find a proper name for each file or make a small comment about what it does inside for future reference

1. Declare a variable `x` and initialize it with an integer.

2. How do you round the number 7.25, to the nearest integer?
> For all the following exercises create a new .js file. Try to find a proper name for each file or make a small comment about what it does inside for future reference. All these

3. Create a array called `colors` with the strings red, green and blue inside.
1. Write a console.log statement saying "Hello World!" for each language that you know.

4. How can you find the length of the string you just created?

5. Write a program that checks the types of two variables and prints out `SAME TYPE` if they are the same type.
For example:
2. Consider the following code:
```
console.log('I'm awesome');
```
2.1 Copy the code in your `.js` file and run it. You will see that you will get a SyntaxError. Find a solution for this error, Hint read the error message carefully, it also gives an indication of where the problem is.

3. Declare a variable `x` and initialize it with an integer.
3.1 First, _declare_ your variable `x`.
3.2 Add a console.log statement that explains that explains in words what _you think_the value of `x` is, like in this example:
```js
// TODO -> here you initialize your variable
console.log('the value of my variable x will be: whateverYouThinkItWillLog');
```
3.3 Add a console.log statement that logs the value of `x`
3.4 Now _initialize_ your variable `x` with an integer
3.5 Now add a console.log statement that explains what _you think_ the value of `x` is.
3.6 Add a console.log statement that logs the value of `x`.
Steps to be taken:

```js
// TODO -> here you declare your variable
console.log('the value of x will be: whateverYouThinkItWillLog');
// TODO -> log the actual value of x
// TODO -> here you initialize your variable
console.log('the value of x will be: whateverYouThinkItWillLog');
// TODO -> log value of x again
```

4. Declare a variable `y` and assign a string to it.
4.1 Write a console.log statement in which you explain in words what _you think_ the value of the string is
4.2 Now console.log the variable `y`.
4.3 Now assign a new string to the variable `y`
4.4 Just like you did before write a console.log statement that explains in words what you think will be logged to the console.
4.5 Now console.log `y` again.
```js
// TODO -> here you declare AND assign your string
console.log('the value of my string will be: whateverYouThinkItWillLog');
// TODO -> log the actual value of the string to the console
// TODO -> assign a new value to your variable x
console.log('the value of my string will be: whateverYouThinkItWillLog');
// TODO -> log the actual value of the string to the console
```

5. How do you round the number 7.25, to the nearest integer?
5.1 Declare a variable `z` and assign the number 7.25 to it.
5.2 Console.log `z`.
5.3 Declare another variable `a` that has the value of z but rounded to the nearest integer.
5.4 Console.log `a`
5.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.
5.6 Console.log the highest value.

6. Arrays!
6.1 Declare an empty array (you can decide on how to call it yourself, but read on a bit here and see if you can find a good name that exactly describes what this variable will hold).
6.2 Write a console.log statement that explains in words what you think the value of the array is.
6.3 Console.log your array.
6.4 Create an array that has your favorite animals inside
6.5 Log your array
6.6 Add a statement that adds Daan's favorite animal (baby pig) to the existing array
6.7 Log your new array!

7. More strings
7.1 Let's consider the following string: `let myString = "this,is,a,test"`.
7.2 Add the string to your file and console.log it.
7.3 Find a way to get the length of `myString`.
7.4 Console.log the length of `myString`.

8. Write a program that checks the types of two variables and prints out `SAME TYPE` if they are the same type.
8.1 First declare at least four variables and assign them different data types.
8.2 For each variable write a `console.log` statement that logs the value
```js
let foo = 3;
console.log('The value of my variable foo is: ' + foo);
```
8.3 Now write a console.log statement wherein you first explain in words what you think the _type_ of your variables is.
8.4 Now use `typeof` to log the actual _type_ of your variables.
8.5 Now compare the types of your different variables with one another.
8.6 Make sure to also show a message when the variables you are comparing are not the same type.
For example:
```js
let x = 9;
let y = 'Hello';

if () {
console.log('SAME TYPE');
}

// TODO -> add a way of giving feedback if your variables don't have the same type
```

6. If `x` equals 7, and the only other statement is `x = x % 3`, what would be the new value of `x`?
9. If `x` equals 7, and the only other statement is `x = x % 3`, what would be the new value of `x`?
9.1 Add at least 3 `console.log` statements in which you show that you understand what `%` does.

7. Write a program to answer the following questions:
* Can you store multiple types in an array? Numbers and strings?
* Can you compare inifities? (Not in Eyad's world) - does 6/0 == 10/0? How can you test this?
10. Write a program to answer the following questions:
10.1 Can you store multiple types in an array? Numbers and strings?
10.2 Can you compare infinities? (Not in Eyad's world) - does 6/0 === 10/0? How can you test this?
10.3 Add console.log statements to the above program's in which you show that you understand the concepts (just like you've done in the above assignments).

### Step 3: **Some freeCodeCamp challenges (10 hours):**

Expand All @@ -83,7 +155,7 @@ steps:
```

### Hint
If you solve the FreeCodeCamp challenges and they are new concepts to you and you would like to take a look at them later on in the program, Copy your answers from FCC in a .js file and upload them to Github in a repository for future reference. In this way you build your own little documentation, if you look back at them first try to understand what it does before you run them.
If you solve the FreeCodeCamp challenges and they are new concepts to you and you would like to take a look at them later on in the program, Copy your answers from FCC in a `.js` file and upload them to Github in a repository for future reference. In this way you build your own little documentation, if you look back at them first try to understand what it does before you run them.

:star: Additional resources and review: [here](https://github.com/HackYourFuture/JavaScript/tree/master/Week1/REVIEW.md) (work in progress):star:

31 changes: 28 additions & 3 deletions Week3/MAKEME.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,34 @@ Your fellow students have provided you with feedback in Trello. Your teachers ha

## Step 2: Reorganize your Github

Your Github should contain two repositories called hyf-javascript1 and hyf-commandline . Inside the JavaScript repository you should have three folders, called week1, week2, and week3 (or something similar). Inside these folders you should have the different assignments (a file per exercises). Ty and find proper names for the exercises that reflect somehow what is going on in the code. Avoid using spaces in your file names, this makes it harder to "run" you files. Also make sure that all your JavaScript files have a .js extension.
Your Github should contain two repositories called hyf-javascript1 and hyf-commandline . Inside the JavaScript repository you should have three folders, called week1, week2, and week3 (or something similar). Inside these folders you should have the different assignments (a file per exercises). Ty and find proper names for the exercises that reflect somehow what is going on in the code. Avoid using spaces in your file names, this makes it harder to "run" you files. Also make sure that all your JavaScript files have a `.js` extension.

## Step 3: Custom DOM manipulation challenge :mortar_board:
## Step 3: String and Array challenges

1. Strings!
1.1 Let's consider the following string: `let myString = "hello,this,is,a,difficult,to,read,sentence"`
1.2 Add the string to your file and console.log it.
1.4 Console.log the length of `myString`.
1.5 The comma's make that the sentence is quite hard to read. Find a way to remove the comma's from the sting and replace them with a spaces
1.6 Console.log `myString` to see if you succeeded.

2. Arrays!
consider the following array:
```js
let favoriteAnimals = ['blowfish', 'capricorn', 'giraffe'];
```
2.6 Add a statement that adds Mauro's favorite animal (turtle) to the existing array
2.7 Log your new array!
2.8 Now add Jim's favorite animal to the array, its a meerkat, but make sure it will be placed after 'blowfish' and before 'capricorn'.
2.9 Write a console.log statement that explains in words _you think_ the new value of the array is.
2.10 Log your new new array!
2.11 Log the length of the array, add a message: "The array has a length of: "(here you should show the length of the array)
2.12 Jason does not like giraffes, delete this animal from the array
2.13 Again log your new array.
2.14 Now if unlike Jim, you don't like meerkats and you want to delete it from the array, but you don't know the position or the `index` of the item in the array, how can you find it?
2.15 Log the index of meerkat to the console. Add a message so it says: "The item you are looking for is at index: " (here you should show the index of the item)

## Step 4: Custom DOM manipulation challenge :mortar_board:

1. Open a new js file and start by declaring an array that contains 10 strings. These strings should be of book titles you have read (or made up) and be lowercase without spaces or special characters so that you can use these later as Id's. (Example: Harry Potter's - The Chamber of Secrets -> `harry_potter_chamber_secrets`).

Expand All @@ -42,7 +67,7 @@ How to hand in your homework:
• Place the link to your repository folder in Trello.
```

## Step 4: **FreeCodeCamp challenges:**
## Step 5: **FreeCodeCamp challenges:**

- https://www.freecodecamp.com/challenges/declare-javascript-objects-as-variables
- https://www.freecodecamp.com/challenges/make-instances-of-objects-with-a-constructor-function
Expand Down