From f17e72b710fb95d0fed19413e4ed552c7b16bdbb Mon Sep 17 00:00:00 2001 From: Collin Duncan Date: Sat, 3 Oct 2020 18:24:55 +0200 Subject: [PATCH 1/6] Updated JS2 Week3 example2 to correctly check for correct solution --- Week3/js-exercises/ex2-RemoveDuplicates.js | 28 ++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/Week3/js-exercises/ex2-RemoveDuplicates.js b/Week3/js-exercises/ex2-RemoveDuplicates.js index 0138e7195..f1eea3b8c 100644 --- a/Week3/js-exercises/ex2-RemoveDuplicates.js +++ b/Week3/js-exercises/ex2-RemoveDuplicates.js @@ -1,21 +1,35 @@ /** ** Exercise 2: The lottery machine ** + Write a function called removeDuplicates. This function accept an array as an argument + does not return anything but removes any duplicate elements from the array. -Write a function called removeDuplicates. This function accept an array as an argument -does not return anything but removes any duplicate elements from the array. + The function should remove duplicate elements. So the result should be: + ['a', 'b', 'c', 'd', 'e', 'f'] - The function should remove duplicate elements.So the result should be: + */ - +/** + * Checks your solution against correct solution + * @param {Array} array your solution + * @returns boolean */ +function checkSolution(array) { + const solution = ['a', 'b', 'c', 'd', 'e', 'f']; + if (array == null) return false; + if (array.length !== solution.length) return false; + for (let i = 0; i < solution.length; i++) { + if (array[i] !== solution[i]) return false; + } + return true; +} // WRITE YOUR FUNCTION HERE const letters = ['a', 'b', 'c', 'd', 'a', 'e', 'f', 'c', 'b']; - removeDuplicates(letters); -if (letters === ['a', 'b', 'c', 'd', 'e', 'f']) - console.log("Hooray!") +if (checkSolution(letters)) { + console.log("Hooray!"); +} \ No newline at end of file From cbdba46346a32ff0a98bb6b71e6f6f7d20b27414 Mon Sep 17 00:00:00 2001 From: Wilgert Velinga Date: Sat, 17 Oct 2020 13:54:40 +0200 Subject: [PATCH 2/6] fix small mistake in week2 exercise 4 rename `collectiveMembers` to `collectiveAge` --- Week2/js-exercises/ex4-collectiveAge.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Week2/js-exercises/ex4-collectiveAge.js b/Week2/js-exercises/ex4-collectiveAge.js index d17275cdc..1ab2bd1f5 100644 --- a/Week2/js-exercises/ex4-collectiveAge.js +++ b/Week2/js-exercises/ex4-collectiveAge.js @@ -30,4 +30,4 @@ const hackYourFutureMembers = [{ }, ]; -console.log("The collective age of the HYF team is: " + collectiveMembers(hackYourFutureMembers)); \ No newline at end of file +console.log("The collective age of the HYF team is: " + collectiveAge(hackYourFutureMembers)); From c455db311e1dae87e9a8d48ffb09c1a7424720f0 Mon Sep 17 00:00:00 2001 From: robvk Date: Fri, 11 Dec 2020 20:05:20 +0100 Subject: [PATCH 3/6] Update MAKEME.md --- Week3/MAKEME.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Week3/MAKEME.md b/Week3/MAKEME.md index 21e861b76..e3a993961 100644 --- a/Week3/MAKEME.md +++ b/Week3/MAKEME.md @@ -17,7 +17,7 @@ Let's get familiar with basic Javascript concepts, with interactive exercises! C > Inside of your `JavaScript2` fork, navigate to the folder `Week3`. Then to the folder `js-exercises`. In this folder you will find separate files for each exercise. Please put your code in the correct file. -**Exercise 1: Add six** +**Exercise 1: Add nine** Declare a function called `createBase`. The function takes a number as a parameter and return a closure, that adds a number to the base number argument. @@ -34,10 +34,10 @@ function createBase() { // Put here your logic... } -const addSix = createBase(6); +const addNine = createBase(6); // Put here your function calls... -addSix(); +addNine(); ``` **Exercise 2: Take out the duplicates** From 70fdbb0954dcfaace89da294742cb1196ea7943d Mon Sep 17 00:00:00 2001 From: robvk Date: Mon, 14 Dec 2020 15:48:09 +0100 Subject: [PATCH 4/6] Update README.md Update the test description to recent changes --- test/README.md | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/test/README.md b/test/README.md index ed8e4da0c..fa484357c 100644 --- a/test/README.md +++ b/test/README.md @@ -3,9 +3,7 @@ You’ll be doing a comprehension test. It will be about the most important JavaScript concepts you’ve learned about so far (JavaScript1 and JavaScript2). ## Practical information -- The test will start at **10.30 until 11.30**. Please be available from 10.15 to avoid being late! -- It will be done online -- There will be 3 questions +Practical information about the test will be shared in the class channel prior to the test. Keep an eye on it! ## Purpose of the test The purpose of this exam is to test your comprehension of JavaScript 1 and JavaScript 2 concepts. @@ -29,12 +27,10 @@ These are the most important concepts that will be tested: Advice on how to optimally prepare: - Find out 2 things about each concepts listed above: (1) how does the basic structure look and (2) what is the most common use case. -- Be familiar with the homework submission process using Git and GitHub. This is the same procedure you'll undergo when starting and submitting your test! +- Be familiar with creating a new project repository in github. For the test you will get some files to edit and they will need to be uploaded to your github. - Ask questions through Slack to your teachers and/or your classmates -- Practice coding WITHOUT Google and on paper. This is very important because the test will be on paper. You can practise this by making your old homework again; but than on paper. Make sure that you can write down functions and loops without syntax errors. - - Practice for understanding (why something is the case), NOT just for repetition’s sake (and hoping ‘you will understand it one day’). - Make a summary of all the study material. @@ -44,7 +40,6 @@ Advice on how to optimally prepare: ## During the test Advise on how to make a test: - **Look for low hanging fruit**. Which of the assignments is easiest for you to do? Tackle that one first. -- Make sure that all **syntax is correct** when writing code on paper. For instance: don’t forget brackets or semicolons. - **If you get stuck in an assignment, move on to the next one**. You can always come back later if time permits. - After finishing an assignment, read the question again to **make sure you actually gave an answer to the question**. - Before handing in the test, read it all over again to pick out the small mistakes. **Double check your work!** @@ -52,17 +47,7 @@ Advise on how to make a test: ## Sample questions 1. Write and call a function that creates and appends a

tag to the of an HTML file. Make use of the already predefined DOM methods createElement() and appendChild(). The innerText of the

should be “hello HackYourFuture!”. -2. Correct the code to make it work, by filling in the grey boxes: -``` -…………… multiplyNumbers( …….. , …….. ) { - const …………… = …….. * …….. ; - return …………… ; - …. - multiplyNumbers( 6 , …………… -// Return value should be 30 -``` - -3. Transform the given array of strings named letters into a new array with numbers (for example: `numbers = [0, 1, 2, 3 ]` ), by creating a new function called lettersToNumbers. Log the new array to the console. Return the new array. Make use of the map() array function. +2. Transform the given array of strings named letters into a new array with numbers (for example: `numbers = [0, 1, 2, 3 ]` ), by creating a new function called lettersToNumbers. Log the new array to the console. Return the new array. Make use of the map() array function. `const letters = [ ‘a’ , ‘b’ , ‘c’ , ‘d’ ];` From cf31f6ca0eb449c7a36e7debda8c52826e3f3f57 Mon Sep 17 00:00:00 2001 From: robvk Date: Wed, 16 Dec 2020 15:16:09 +0100 Subject: [PATCH 5/6] Update README.md --- Week3/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Week3/README.md b/Week3/README.md index 24e2f12cb..c4a41dd4f 100644 --- a/Week3/README.md +++ b/Week3/README.md @@ -146,7 +146,7 @@ The execution context roughly equates to the 'environment' a function executes i Checkout the following to learn more about why this is important: -- [What is the Execution Context & Stack in JavaScript?](http://davidshariff.com/blog/what-is-the-execution-context-in-javascript/) +- [What is the Execution Context & Stack in JavaScript?](https://blog.bitsrc.io/understanding-execution-context-and-execution-stack-in-javascript-1c9ea8642dd0) ### Why do we need closures? From 8e77a7ea1bee5d6aed42d4bee5fcb6f683c4f40c Mon Sep 17 00:00:00 2001 From: robvk Date: Tue, 26 Jan 2021 13:08:13 +0100 Subject: [PATCH 6/6] Update README.md Deprecation notice --- README.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d6399b7d1..371029faf 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,8 @@ -> 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). +# DEPRECATED - JavaScript 2 +This module has been replace with the Browsers module, find it [here](https://github.com/HackYourFuture/Browsers) -> 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/JavaScript2/pulls). -# Module #3 - JavaScript 2: DOM Manipulation (Frontend) - -![JavaScript2](./assets/javascript2.png) - -If you were to ask a random person on the street the question "What is a browser?", you'll most likely get a variety of (incorrect) answers. For proof, check [this](https://www.youtube.com/watch?v=o4MwTvtyrUQ) out. +```If you were to ask a random person on the street the question "What is a browser?", you'll most likely get a variety of (incorrect) answers. For proof, check [this](https://www.youtube.com/watch?v=o4MwTvtyrUQ) out. You might be one of those people right now, but after this module no more. In **JavaScript2** you'll learn all about how to use JavaScript within the browser. @@ -80,4 +76,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 :)_ -Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. +Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.```