diff --git a/.eslintrc.json b/.eslintrc.json
index 263f18df1..1c1b99549 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -1,8 +1,16 @@
{
- "extends": ["airbnb", "prettier"],
+ "extends": ["airbnb-base", "prettier"],
"plugins": ["prettier"],
"env": {
- "browser": true
+ "browser": true,
+ "jest": true
+ },
+ "globals": {
+ "page": true,
+ "browser": true,
+ "context": true,
+ "jestPuppeteer": true,
+ "axios": "readonly"
},
"rules": {
"prettier/prettier": ["error"],
@@ -10,6 +18,7 @@
"strict": "off",
"no-plusplus": "off",
"linebreak-style": "off",
+ "no-restricted-syntax": "off",
"no-param-reassign": [
"error",
{
diff --git a/.gitignore b/.gitignore
index 6c589c2f8..171af4338 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,3 +59,4 @@ typings/
.netlify
dist/
+iPhoneX.png
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 000000000..469f36b11
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,10 @@
+{
+ "recommendations": [
+ "CoenraadS.bracket-pair-colorizer",
+ "dbaeumer.vscode-eslint",
+ "esbenp.prettier-vscode",
+ "ritwickdey.LiveServer",
+ "streetsidesoftware.code-spell-checker",
+ "techer.open-in-browser"
+ ]
+}
diff --git a/.vscode/settings.json b/.vscode/settings.json
index f7a55df12..183110862 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -5,6 +5,13 @@
"editor.detectIndentation": false,
"editor.tabSize": 2,
"cSpell.words": [
- "tabindex"
- ]
-}
\ No newline at end of file
+ "READYSTATE",
+ "Traversy",
+ "ajaxcrash",
+ "networkidle",
+ "remarcmij",
+ "tabindex",
+ "whiteframe"
+ ],
+ "deno.enable": false
+}
diff --git a/README.md b/README.md
index fa97dad57..55310b364 100644
--- a/README.md
+++ b/README.md
@@ -1,23 +1,131 @@
-> 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/JavaScript3/pulls).
+# DEPRECATED - JavaScript 3
+This module has been replace with the Using API's module, find it [here](https://github.com/HackYourFuture/UsingAPIs)
-# HackYourFuture JavaScript 3
+```Welcome to JavaScript3! Congratulations on making it this far. You're well on your way to the top!
-Here you can find course content and homework for the JavaScript3 modules
+A big part of being a programmer means moving data from one place to another. It also means working with other people's software. In this module you'll be learning about one of the core things of what makes a web developer: working with APIs!
-|Week|Topic|Read|Homework|
-|----|-----|----|--------|
-|1.|• Structure for a basic SPA (Single Page Application) • [XMLHttpRequests](../../../fundamentals/blob/master/fundamentals/XMLHttpRequest.md) • API calls|[Reading Week 1](/Week1/README.md)|[Homework Week 1](/Week1/MAKEME.md)|
-|2.|• [Event Loop (order of execution)](../../../fundamentals/blob/master/fundamentals/event_loop.md) • [Promises](../../../fundamentals/blob/master/fundamentals/promises.md)|[Reading Week 2](/Week2/README.md)|[Homework Week 2](/Week2/MAKEME.md)|
-|3.|• [try...catch](../../../fundamentals/blob/master/fundamentals/try_catch.md) • [async/await](../../../fundamentals/blob/master/fundamentals/async_await.md) • [The `this` keyword](../../../fundamentals/blob/master/fundamentals/this.md) • call, apply, bind • [Object Oriented Programming and ES6 Classes](../../../fundamentals/blob/master/fundamentals/oop_classes.md)|[Reading Week 3](/Week3/README.md)|[Homework Week 3](/Week3/MAKEME.md)|
+On top of that you'll also learn how to think differently about _how_ you write your programs. Like in any field, once you've mastered a particular way of doing things you start thinking about how it could be done in a smarter, different way. In programming we call these `paradigms` and in this module you'll learn one such paradigm: Object-Oriented Programming!
-__Kind note:__
+## Before you start
-We expect you to __always__ come prepared to the class on Sunday.
+In the following weeks we will be using a "style guide" to help you write _"clean code"_. Because code is not only meant to be run by computers, but also to be read by humans (your colleagues, and the future version of you), it's best to make your code good. If your code is readable and nicely formatted, you're doing your colleages (and future you) a great service. The idea of a "style guide" comes from visual design, where companies often have a "visual style". For example, watch the following video to get an idea of this:
-### Overall
-A good understanding of all the above mentioned topics. Want to check your Knowledge? Go through the [JavaScript Fundamentals README](../../../fundamentals/blob/master/README.md) and research/ ask for help (Slack!) with the concepts that are not entirely clear.
+### Setup Style Guide
-*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 :)*
+Similar to how designers have style guides for their design work, programmers often have "programming style guides". This is set of rules to follow when writing/formatting your code. The styleguide we'll be using is the one from Airbnb:
- This work is licensed under a Creative Commons Attribution 4.0 International License.
+- [Front-end Style Guides](https://fronteers.nl/congres/2015/sessions/front-end-style-guides-anna-debenham)
+
+The style guide we'll be using is the one from Airbnb:
+
+- [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript)
+
+While you do not need to read this guide in detail, it is recommended that you look at sections 1-8, 12-13, 15-21 and 23.
+
+We also have tools that can automatically check whether your code is correctly formatted according to a style guide. These tools are called "linters". We will be using the JavaScript linter called "ESLint". The following packages are already added to this repository's `package.json`:
+
+The required packages you need to install before you write code according to the style guide are the following:
+
+`json
+"eslint"
+"eslint-config-airbnb-base"
+"eslint-config-prettier"
+"eslint-plugin-import"
+"eslint-plugin-prettier"
+"prettier"
+`
+
+They are already in this repository's `package.json` so all you have to do now to prepare is to execute the following command at the root of this module directory:
+
+`md
+npm install
+`
+
+### Forking the right repository
+
+Before you start with the homework, make sure you've made a fork of the right repository: [HackYourHomework/JavaScript3](https://www.github.com/hackyourhomework/javascript3)). Once you've cloned it to your computer you can proceed by making GIT branches for each week. Start at the `master` branch and execute the following (note that they're 3 different commands):
+
+`bash
+foo@bar:~$ git branch week1-YOURNAME
+foo@bar:~$ git branch week2-YOURNAME
+foo@bar:~$ git branch week3-YOURNAME
+`
+
+Then execute `git checkout week1-YOURNAME` and you can get started!
+
+If you have any questions or if something is not entirely clear ¯\_(ツ)\_/¯, please ask/comment on Slack!
+
+## Learning goals
+
+In order to successfully complete this module you will need to master the following:
+
+- Learn what an `Application Programming Interface` (API) is
+- Catch up on the `history of JavaScript`
+- Understand how to write more readable `asynchronous JavaScript`
+- Connect with different `public APIs`
+- Build a `Single Page Application` (SPA)
+- Work with pre-existing code
+- Learn about `Object-Oriented Programming`
+
+## How to use this repository
+
+### 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 JavaScript3 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 `JavaScript3`, 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 JavaScript2 module)
+3. On **Friday** you start with the homework, found in the `MAKEME.md`. For the first week of `JavaScript3`, 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 [Stasel Seldin](https://hackyourfuture.slack.com/team/UQJGC1MSL): senior iOS developer!
+
+You can find out more about him here:
+
+- [GitHub](https://github.com/Stasel)
+- [@Stasel on Slack](https://hackyourfuture.slack.com/team/UQJGC1MSL)
+
+Learn from Stasel in the following playlist of videos he has made for you! (Click on the image to open the link)
+
+
+
+## Planning
+
+| Week | Topic | Reading Materials | Homework | Lesson Plan |
+| ---- | ------------------------------------------------------------------------------------------- | ------------------------------ | ------------------------------- | -------------------------------------- |
+| 1. | Application Programming Interface (API), AJAX, Modules & Libraries | [Reading W1](/Week1/README.md) | [Homework W1](/Week1/MAKEME.md) | [Lesson Plan W1](/Week1/LESSONPLAN.md) |
+| 2. | Promises, Fetch API, JavaScript Versions, 'this' keyword, Arrow functions | [Reading W2](/Week2/README.md) | [Homework W2](/Week2/MAKEME.md) | [Lesson Plan W1](/Week2/LESSONPLAN.md) |
+| 3. | Object-Oriented Programming (OOP), ES6 Classes, Async/await, Thinking like a programmer III | [Reading W3](/Week3/README.md) | [Homework W3](/Week3/MAKEME.md) | [Lesson Plan W1](/Week3/LESSONPLAN.md) |
+| 4. | Final JavaScript Test | [Details](test.md) | - | - |
+
+## Finished?
+
+Did you finish the module? High five!
+
+If you feel ready for the next challenge, click [here](https://www.github.com/HackYourFuture/Node.js) to go to Node.js!
+
+_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.```
diff --git a/Week1/LESSONPLAN.md b/Week1/LESSONPLAN.md
new file mode 100644
index 000000000..a0d1c8f0e
--- /dev/null
+++ b/Week1/LESSONPLAN.md
@@ -0,0 +1,141 @@
+# Lesson Plan JavaScript3 Week 1
+
+## Agenda
+
+The purpose of this class is to introduce to the student:
+
+- What are `APIs` and how to interact with them
+- What is `AJAX` and how to apply it (`XMLHttpRequest`)
+- How to use libraries (`axios`)
+
+## Core concepts
+
+FIRST HALF (12.00 - 13.30)
+
+## 1. What are APIs and how to interact with them
+
+### Explanation
+- APIs are created by providers and used by consumers (BE provider, FE consumer)
+- Part of an application that can be communicated with from an outside source
+- Connect to it using "endpoints"
+- Software well-known APIs (Fb APIs, Twitter APIs, Maps APIs, weather APIs);
+- API doesn't care which language or technology is used in the consumer or the provider
+
+#### Types of APIs:
+- Private: for employees only under a company network for internal use.
+- Semi-private: for clients who paid for the API.
+- Public: for everyone on the web.
+
+#### Architecture styles of API:
+- Single purpose: API that gives a direct and specific service.
+- Aggregated API: one API as a wrapper for multiple APIs.
+- Web services API: punch of APIs working together to forma whole app.
+
+#### Basic structure of REST API
+
+- Endpoint: https://api.example.com
+- Endpoint with version: https://api.example.com/v1
+- Resources:
+* https://api.example.com/v1/users
+* https://api.example.com/v1/users/create
+* https://api.example.com/v1/users/1
+* https://api.example.com/v1/users/1/edit
+- Query params:
+* https://api.example.com/v1/users?limit=10
+### Example
+- Give real life example like (Devices like TV, any machine + electricity power socket interface which provides power to any external device)
+
+### Excercise
+
+### Essence
+- Mostly used to request data from some service
+- Communication between software and user needs UI interface but software and software needs API as an interface.
+
+## 2. What is `AJAX` and how to apply it (`XMLHttpRequest`)
+
+### Explanation
+- Before AJAX all page reload for all requests, via refreshing the url in the address bar with the new resource.
+- It's a technique, not a technology
+- `AJAX` stands for Asynchronous JavaScript and XML
+- Nowadays we use `JSON` instead of `XML`
+- Fetch data without reloading the page
+- The XMLHttpRequest API is defined in the browser (window.XMLHttpRequest)
+### Example
+Example using the XMLHttpRequest
+
+```javascript
+const oReq = new XMLHttpRequest();
+oReq.open('GET', `https://api.openweathermap.org/data/2.5/weather?q=${cityName}`);
+oReq.send();
+oReq.addEventListener('load', function (event) {
+ const data = JSON.parse(this.response);
+ if (data.cod >= 400) {
+ // error
+ console.log(data.message);
+ } else {
+ //success
+ console.log(data.coord.lat);
+ }
+});
+
+// or another way of getting data
+oReq.load = function (event) {
+ // use oReq.response or this.response
+ const data = JSON.parse(this.response);
+ if (data.cod >= 400) {
+ // error
+ console.log(data.message);
+ } else {
+ //success
+ console.log(data.coord.lat);
+ }
+};
+
+```
+
+### Excercise
+
+Steps of doing the following example:-
+** Install the live server plugin in VS (go to plugins -> live server -> install)
+1. Create self-invoked function to wrap your code
+2. Create an object instance of `XMLHttpRequest`
+3. Call the `open` function to fill it with the Request URL and the request Method
+4. Call the `send` function to make the request
+5. Add event listener with a callback for the sucess event `load`
+
+### Essence
+
+SECOND HALF (14.00 - 16.00)
+
+## 3. How to use libraries (`axios`)
+
+### Explanation
+- A library is a code solution a developer (or a team) has written to a common problem
+- Usually open-source
+- Helps to solve a problem within an application
+- Read the documentation on how to use it
+### Example
+Same example but using axios
+```javascript
+axios
+ .get(`https://api.openweathermap.org/data/2.5/weather?q=${cityName}`)
+ .then(function (response) {
+ // handle success
+ console.log(response.data);
+ }).catch(function (error) {
+ // handle error
+ console.log(error);
+ }).finally(function () {
+ // always be executed
+ console.log('I am always here')
+ });
+```
+
+> Note: Give example at the end with binding/showing these data in a DOM element like a
or a list instead of only showing them on the console using console.log.
+
+### Excercise
+### Essence
+
+
+
+
diff --git a/Week1/MAKEME.md b/Week1/MAKEME.md
index eed3987c8..6f040f6bc 100644
--- a/Week1/MAKEME.md
+++ b/Week1/MAKEME.md
@@ -1,251 +1,134 @@
-# Homework Week 1
+# Homework JavaScript3 Week 1
-```
-Topics discussed this week:
-• Structure for a basic SPA
-• XMLHttpRequests
-• API calls
-```
-
-## Step 1: Single Page Application :sweat_drops:
-
-**_Deadline Thursday_**
-
-_This homework is more extensive and challenging than previous homework! Please read the instructions below carefully and follow them with great attention to detail. Start this homework as soon as you can and allow time for discussion and questions (slack!)._
-
-### 1.1 Introduction
-
-> In this assignment you will built upon some existing code that is already pre-written by your teachers. Your homework consist of writing the code to make the application work as requested per week.
-
-You are going to write a _Single Page Application_ (SPA) that uses the [GitHub API](https://developer.github.com/guides/getting-started/).
-
-This application should display information about the available [HYF GitHub repositories](https://github.com/hackyourfuture). The functionalities we would like to see in your application are as follows:
-
-- The user should be able to select a repository from a list of available repositories.
-- The application should display high-level information about the selected repository and show a list of its contributors.
-- When clicking on the name of the selected repository the GitHub page for the corresponding repository should be opened in a new browser tab.
-- When clicking on a contributor, the GitHub page for the contributor should be opened in a new browser tab.
-
-Figure 1 below shows an example of what your application could look like. Note that this is just an example. If you find it boring or unimaginative, please improve on it! On the other hand, a simpler version is OK too, so long as you implement the expected functionality.
-
-
-
-Figure 1. Example User Interface using [Material Design](https://material.io/guidelines/) principles.
-
-A live version of this application can be found here: http://hyf-github.netlify.com/
-
-### 1.2 The GitHub API
-
-#### 1.2.1 Get a list of HYF repositories
-
-You can fetch a list of HYF repositories through this API endpoint ([What is an API Endpoint?](https://teamtreehouse.com/community/what-is-an-api-endpoint)):
-
-```
-https://api.github.com/orgs/HackYourFuture/repos?per_page=100
-```
-
-If you open this URL in the browser (_try it!_) you will receive JSON data about the available HYF repositories. This is the data that you will need to work with in this assignment.
-
-Note the query string `?per_page=100` in the above URL. If you don't specify this query string you will only get the first 30 repositories (the default `per_page` is 30). HackYourFuture has more than 30 repositories but less than 100.
-
-The returned JSON data contains some basic information about each repository, such as `name`, `full_name`, `description` etc. There are also many properties that contain URLs that can be used to obtain detail information about certain aspects of the repository.
-
-#### 1.2.2 Get contributor information for a repository
-
-The JSON data that is returned from the initial request to get repository information includes a property named `contributors_url`. Use the value of this property to fetch a list of contributors.
-
-#### 1.2.3 GitHub API documentation
-
-You can find detailed information about the GitHub API by means of the link listed below. However, the documentation is very extensive and not easy to digest. For this homework it is not necessary to study the GitHub API documentation. We provide the link here for completeness.
+## **Todo list**
-> GitHub API documentation: https://developer.github.com/v3/
+1. Practice the concepts
+2. JavaScript exercises
+3. Code along
+4. PROJECT: Hack Your Repo I
-### 1.3 Coding Style
+## **1. Practice the concepts**
-In this homework we will be introducing a preferred coding style and supporting tools to help you write _"clean code"_. A number of popular [_JavaScript Style Guides_](https://codeburst.io/5-javascript-style-guides-including-airbnb-github-google-88cbc6b2b7aa) have recently emerged of which the one developed by [Airbnb](https://github.com/airbnb/javascript) has been chosen for this homework and is recommended for subsequent use during the HYF curriculum. It is documented here:
+This week's concepts can be challenging, therefore let's get an easy introduction using some interactive exercises! Check the following resources out and start practicing:
-- [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript)
+- [Learn JavaScript: Requests](https://www.codecademy.com/learn/introduction-to-javascript/modules/intermediate-javascript-requests)
-While you do not need to read this guide in detail, it is recommended that you review sections 1-8, 12-13, 15-21 and 23. The tools installed during the project preparation step below will help you to implement these guidelines in your code. You will see error and warning messages in the VSCode editor when your code deviates from the recommended style. An additional check will be done when you submit your homework as a pull request on GitHub.
+## **2. JavaScript exercises**
-### 1.5 Preparation
+> Inside of your `JavaScript3` fork and inside of the `Week1` folder, create a folder called `homework`. Inside of that folder, create a folder called `js-exercises`. For all the following exercises create a new `.js` file in that folder (3 files in total). Make sure the name of each file reflects its content: for example, the filename for exercise one could be `getRandomUser.js`.
-You will be working on the same application during the next three weeks. For each week you will need to create a new Git branch, as listed in the Table 1 below.
+**Exercise 1: Who do we have here?**
-| Week | Branch | Assignment |
-| :--: | ------- | -------------------------------------------------------------------------------------------------------------------------------- |
-| 1 | `week1` | - Create a basic application using callbacks to handle network requests. |
-| 2 | `week2` | Based on the `week1` branch: - Refactor the callbacks to promises. - Make the UI responsive. |
-| 3 | `week3` | Based on the `week2` branch: - Refactor the application to use ES6 Classes and async/await. - Make the app ARIA-compliant. |
+Wouldn't it cool to make a new friend with just the click of a button?
-Table 1. Homework schedule
+Write a function that makes a HTTP Request to `https://www.randomuser.me/api`
-**Instructions**
+- Inside the JavaScript file write two functions: one with `XMLHttpRequest`, and the other with `axios`
+- Each function should make a HTTP Request to the given endpoint: `https://www.randomuser.me/api`
+- Log the received data to the console
+- Incorporate error handling: log to the console the error message
-1. Fork the JavaScript3 repository (_this repository_) to your own GitHub account.
-2. Clone the fork to your laptop.
-3. Open the newly created `JavaScript3` folder from the cloned repository in VSCode.
-4. Install the following extension in VSCode:
+**Exercise 2: Programmer humor**
- **Prettier - Code formatter**.
+Who knew programmers could be funny?
-5. Open a Terminal window in VSCode and type the following command to install Prettier and ESLint tools as required for the homework:
+Write a function that makes a HTTP Request to `https://xkcd.now.sh/?comic=latest`
- ```
- npm install
- ```
+- Inside the same file write two programs: one with `XMLHttpRequest`, and the other with `axios`
+- Each function should make a HTTP Request to the given endpoint: `https://xkcd.now.sh/?comic=latest`
+- Log the received data to the console
+- Render the `img` property into an `` tag in the DOM
+- Incorporate error handling: log to the console the error message
-6. Create a new branch for the week 1 homework with the following command:
+**Exercise 3: Dog photo gallery**
- ```
- git checkout -b week1
- ```
+Let's make a randomized dog photo gallery!
-### 1.5 Code Overview
+Write a function that makes a HTTP Request to `https://dog.ceo/api/breeds/image/random`. It should trigger after clicking a button in your webpage. Every time the button is clicked it should append a new dog image to the DOM.
-The files that make up the application are located in the `homework` folder. It contains the following files:
+- Create an `index.html` file that will display your random image
+- Add 2 `