From 5ef0796e45b4cdcb484800fa5d2bf3ed94367f33 Mon Sep 17 00:00:00 2001 From: davhojt Date: Fri, 29 Apr 2022 14:43:43 +0100 Subject: [PATCH 01/26] docs(how-2-js): correct grammar --- subjects/how-2-js/README.md | 60 +++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/subjects/how-2-js/README.md b/subjects/how-2-js/README.md index b5a324802..10dff2a6d 100644 --- a/subjects/how-2-js/README.md +++ b/subjects/how-2-js/README.md @@ -2,48 +2,50 @@ ### Instructions -Hello and welcome to the JS piscine, first you will have to learn -to execute javascript. +Welcome to the JS piscine 👋. -Being a special child, JS can run in different **runtime**, what you can -do with it greatly depend of your runtime. +First you will have to learn to execute JavaScript. -Luckily you don't need to install anything for that since all you -need is a web browser. +JavaScript can run in different **runtime** environments. What you can do with JavaScript will greatly depend on the runtime. Even different web browsers (Chrome, Firefox, Safari etc) count as different runtime environments. -> Main runtime for executing JS are: any web browser, NodeJS and Deno. +We'll start by running JavaScript in your browser, so you don't need to install anything to get started. -Let's make a hello world: +Some common JavaScript runtime environments: +- Web browsers +- [Node.js](https://nodejs.org/) +- [Deno](https://deno.land/) -```bash -# first we create the javascript file -echo "console.log('Hello World')" > how-2-js.js +Let's make a hello world. First we create the JavaScript file -# To run JS in your browser you need to import it from an HTML page: -echo '' > index.html +```sh +$ echo "console.log('Hello World')" > how-2-js.js +``` +To run JavaScript in your browser, you can import it into a HTML page: +```sh +$ echo '' > index.html +``` -# Finally let's create a simple web server -&>/dev/null python3 -m http.server & +Let's create a simple web server: +```sh +$ &>/dev/null python3 -m http.server & +``` -# Now open your browser at the specified port +Now open your browser at the specified port. You'll use an appropriate command for your system: + +- Linux: `xdg-open` +- macOS: `open` +- Windows: `start` +```sh xdg-open 'http://localhost:8000' ``` -> `xdg-open` find your default application for the given argument -> on mac it's just `open` and it's `start` on windows - -You can now open your web browser console (`ctrl`+`shift`+`i`) -and you should see your hello world. -> The console is a very handy place to test code and explore how the language -> works, don't be shy and play in it ! +You can now open your web browser console. From Google Chrome, press **Command+Option+J** (Mac) or **Control+Shift+J** (Windows, Linux, ChromeOS), and you should see your hello world. -Great ! you are all set, if you want to re-execute your script, just refresh. +The console is a handy place to test your code. -You now just have to create a repository named `((ROOT))`, -which will hold all your solutions for this piscine -and just add your 2 generated files to it, we will start slow for now... 🐢 +You are all set. If you want to re-execute your script, just refresh. -### Recommendation +Create a repository named `((ROOT))` which will hold all your solutions for this piscine. Add your 2 generated files to it. -Videos designed to give **hints** are assigned to each quest. It is strongly suggested to watch them as you go. +We'll start slow for now... 🐢 From 5ce8e6c2a635b115256c816c1207e05cc1666ea1 Mon Sep 17 00:00:00 2001 From: davhojt Date: Fri, 29 Apr 2022 22:49:38 +0100 Subject: [PATCH 02/26] docs(primatives): correct grammar --- subjects/primitives/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/subjects/primitives/README.md b/subjects/primitives/README.md index 4c838fd1f..899aa879e 100644 --- a/subjects/primitives/README.md +++ b/subjects/primitives/README.md @@ -2,14 +2,14 @@ ### Instructions -Create a constant variable for each primitives: +Create a constant variable for each of the following primitive types: -- `str` for `String` -- `num` for `Number` -- `bool` for `Boolean` +- `str` for `string` +- `num` for `number` +- `bool` for `boolean` - `undef` for `undefined` ### Notions -- [nan-academy.github.io/js-training/examples/primitive-and-operators](https://nan-academy.github.io/js-training/examples/primitive-and-operators.js) -- [nan-academy.github.io/js-training/examples/variables](https://nan-academy.github.io/js-training/examples/variables.js) +- [Primitives and operators](https://nan-academy.github.io/js-training/examples/primitive-and-operators.js) +- [Variables](https://nan-academy.github.io/js-training/examples/variables.js) From ad1e1f316e9d726f69b1ef1236765139a22a0a09 Mon Sep 17 00:00:00 2001 From: davhojt Date: Sat, 30 Apr 2022 00:01:22 +0100 Subject: [PATCH 03/26] docs(declarations): correct grammar --- subjects/declarations/README.md | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/subjects/declarations/README.md b/subjects/declarations/README.md index 155c9cae0..b0c3a1f12 100644 --- a/subjects/declarations/README.md +++ b/subjects/declarations/README.md @@ -4,22 +4,25 @@ Create the following constant variables: -- `escapeStr`, that contains the following specials characters: `` ` ``, `\`, `/`, `"`, `'` -- `arr` that is an array containing the values 4 and '2' -- `obj` that is an object containing a property for each primitives: - - `str` for `String` - - `num` for `Number` - - `bool` for `Boolean` - - `undef` for `undefined` -- A `nested` object that contains - - arr: an array of the 3 values: 4, undefined, '2' - - obj: an object with 3 property (str, num & bool) +- `escapeStr`: a `string` which contains the following special characters: `` ` ``, `\`, `/`, `"` and `'`. +- `arr`: an array containing the values `4` and `'2'`. +- `obj`: an object containing primitive values: + - `str`: with a `string` value. + - `num`: with a `number` value. + - `bool`: with a `boolean` value. + - `undef`: with a `undefined` value. +- `nested`: an object containing: + - `arr`: an array of 3 values: `4`, `undefined` and `'2'`. + - `obj`: an object with 3 properties + - `str` with a `string` value. + - `num` with a `number` value. + - `bool` with a `boolean` value. -`nested`, `arr` and `obj` must be frozen to prevent changes from them. +`nested`, `arr` and `obj` must be frozen, so that their elements or properties cannot be changed. ### Notions - Primitive and Operators - Variables -- [nan-academy.github.io/js-training/examples/data-structures.js](https://nan-academy.github.io/js-training/examples/data-structures.js) -- [devdocs.io/javascript/global_objects/object/freeze](https://devdocs.io/javascript/global_objects/object/freeze) +- [Data Structures](https://nan-academy.github.io/js-training/examples/data-structures.js) +- [Freeze](https://devdocs.io/javascript/global_objects/object/freeze) From c3e13bb0d9f6705867c32e703f2f8b11336aa417 Mon Sep 17 00:00:00 2001 From: davhojt Date: Sat, 30 Apr 2022 00:01:40 +0100 Subject: [PATCH 04/26] docs(mutability): correct grammar --- subjects/mutability/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/subjects/mutability/README.md b/subjects/mutability/README.md index 187f6bf74..df86266d8 100644 --- a/subjects/mutability/README.md +++ b/subjects/mutability/README.md @@ -2,21 +2,21 @@ ### Instructions -Create three copies of the person object called `clone1`, `clone2` and `samePerson`. +Create three copies of the `person` object named `clone1`, `clone2` and `samePerson`. -Increase by one the property age of `person` and set his country to `'FR'`. +Increase the `age` of `person` by one, and set its `country` to `'FR'`. -A way must be found to have `clone1` and `clone2` keep the original values while `samePerson` changes with `person`. +You must find a way to keep the original values of `clone1` and `clone2`. The values of `samePerson` should change when `person` is changed. ### Notions -- [nan-academy.github.io/js-training/examples/set](https://nan-academy.github.io/js-training/examples/set.js) -- [nan-academy.github.io/js-training/examples/get](https://nan-academy.github.io/js-training/examples/get.js) -- [nan-academy.github.io/js-training/examples/data-structures](https://nan-academy.github.io/js-training/examples/data-structures.js) +- [Set](https://nan-academy.github.io/js-training/examples/set.js) +- [Get](https://nan-academy.github.io/js-training/examples/get.js) +- [Data Structures](https://nan-academy.github.io/js-training/examples/data-structures.js) ### Code provided -> all code provided will be added to your solution and doesn't need to be submited. +> The provided code will be added to your solution, and does not need to be submitted. ```js const person = { From d2e1dcf8208d488351b4235eccf02ec4e38d703e Mon Sep 17 00:00:00 2001 From: davhojt Date: Sat, 30 Apr 2022 00:01:51 +0100 Subject: [PATCH 05/26] docs(more-or-less): correct grammar --- subjects/more-or-less/README.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/subjects/more-or-less/README.md b/subjects/more-or-less/README.md index c8d3e0db1..c24402bd5 100644 --- a/subjects/more-or-less/README.md +++ b/subjects/more-or-less/README.md @@ -2,14 +2,13 @@ ### Instructions -Create 4 functions - -- `more` that takes 1 argument and add 1 to it -- `less` that takes 1 argument and subtract 1 to it -- `add` that takes 2 arguments and add them -- `sub` that takes 2 arguments and subtract them +Create 4 functions: +- `more` that takes 1 argument and adds 1 to it. +- `less` that takes 1 argument and subtracts 1 from it. +- `add` that takes 2 arguments and adds them together. +- `sub` that takes 2 arguments and subtracts the second argument from the first. ### Notions -- [nan-academy.github.io/js-training/examples/functions](https://nan-academy.github.io/js-training/examples/functions.js) -- [nan-academy.github.io/js-training/examples/primitive-and-operators](https://nan-academy.github.io/js-training/examples/primitive-and-operators.js) +- [Functions](https://nan-academy.github.io/js-training/examples/functions.js) +- [Primitives and Operators](https://nan-academy.github.io/js-training/examples/primitive-and-operators.js) From 4bb2147297e71f3ba8b2a89e28ef20260624e24c Mon Sep 17 00:00:00 2001 From: davhojt Date: Sat, 30 Apr 2022 00:03:46 +0100 Subject: [PATCH 06/26] docs(returns): correct grammar --- subjects/returns/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subjects/returns/README.md b/subjects/returns/README.md index 932538c4b..d8083ebb0 100644 --- a/subjects/returns/README.md +++ b/subjects/returns/README.md @@ -4,11 +4,11 @@ Create the following functions: -- `id` that takes one argument and return it -- `getLength` that takes an array or a string and return its length +- `id` that takes one argument and returns it. +- `getLength` that takes an array or a string and returns its length. ### Notions -- [nan-academy.github.io/js-training/examples/functions](https://nan-academy.github.io/js-training/examples/functions.js) -- [nan-academy.github.io/js-training/examples/data-structures](https://nan-academy.github.io/js-training/examples/data-structures.js) -- [nan-academy.github.io/js-training/examples/get](https://nan-academy.github.io/js-training/examples/get.js) +- [Functions](https://nan-academy.github.io/js-training/examples/functions.js) +- [Data Structures](https://nan-academy.github.io/js-training/examples/data-structures.js) +- [Get](https://nan-academy.github.io/js-training/examples/get.js) From 295bf143193952f3964d7b077bf4f0bd194980ca Mon Sep 17 00:00:00 2001 From: davhojt Date: Sat, 30 Apr 2022 00:08:01 +0100 Subject: [PATCH 07/26] docs(first-last-kiss): correct grammar --- subjects/last-first-kiss/README.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/subjects/last-first-kiss/README.md b/subjects/last-first-kiss/README.md index c3d493e90..05cd6057e 100644 --- a/subjects/last-first-kiss/README.md +++ b/subjects/last-first-kiss/README.md @@ -4,16 +4,13 @@ Create 3 functions: -- a `first` function that takes an array or a string - and return the first element. +- `first`: that takes an array or a string and returns its first element or character. -- a `last` function that takes an array or a string - and return the last element. +- `last`: that takes an array or a string and return its last element or character. -- a `kiss` function that returns an array of 2 elements - the last and the first element, in that order +- `kiss`: that takes an array or string, and returns an array of 2 elements. The returned array should contain the last and first elements or characters, in that order. ### Notions -- [nan-academy.github.io/js-training/examples/data-structures.js](https://nan-academy.github.io/js-training/examples/data-structures.js) -- [nan-academy.github.io/js-training/examples/get.js](https://nan-academy.github.io/js-training/examples/get.js) +- [Data Structures.js](https://nan-academy.github.io/js-training/examples/data-structures.js) +- [Get.js](https://nan-academy.github.io/js-training/examples/get.js) From 57f3844dddd153f2c66d0620bf3ef83e73fb8db0 Mon Sep 17 00:00:00 2001 From: davhojt Date: Sat, 30 Apr 2022 00:09:18 +0100 Subject: [PATCH 08/26] docs(concat-str): correct grammar --- subjects/concat-str/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subjects/concat-str/README.md b/subjects/concat-str/README.md index a7bb735d8..5653dd772 100644 --- a/subjects/concat-str/README.md +++ b/subjects/concat-str/README.md @@ -2,9 +2,9 @@ ### Instructions -Create a `concatStr` function that takes 2 arguments and concatenate them +Create a function named `concatStr` which takes 2 arguments and concatenates them. ### Notions -- [nan-academy.github.io/js-training/examples/functions.js](https://nan-academy.github.io/js-training/examples/functions.js) -- [nan-academy.github.io/js-training/examples/primitive-and-operators.js](https://nan-academy.github.io/js-training/examples/primitive-and-operators.js) +- [Functions.js](https://nan-academy.github.io/js-training/examples/functions.js) +- [Primitive and Operators.js](https://nan-academy.github.io/js-training/examples/primitive-and-operators.js) From 1e68b12c89e86f487188673b23a6e30b4511e411 Mon Sep 17 00:00:00 2001 From: davhojt Date: Sat, 30 Apr 2022 00:13:32 +0100 Subject: [PATCH 09/26] docs(change): correct grammar --- subjects/change/README.md | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/subjects/change/README.md b/subjects/change/README.md index 64a841439..4077fb46d 100644 --- a/subjects/change/README.md +++ b/subjects/change/README.md @@ -4,23 +4,20 @@ Create 2 functions: -- `get`: a function that takes a key and return the corresponding - value from the sourceObject +- `get`: a function that takes a key and returns the corresponding value from the `sourceObject`. -- `set`: a function that takes a key and a value update the - value for the corresponding property of the sourceObject - and return the set value +- `set`: a function that takes a key and a value. Update the value for the corresponding property of the `sourceObject` and return the value. ### Notions -- [nan-academy.github.io/js-training/examples/functions.js](https://nan-academy.github.io/js-training/examples/functions.js) -- [nan-academy.github.io/js-training/examples/data-structures.js](https://nan-academy.github.io/js-training/examples/data-structures.js) -- [nan-academy.github.io/js-training/examples/get.js](https://nan-academy.github.io/js-training/examples/get.js) -- [nan-academy.github.io/js-training/examples/set.js](https://nan-academy.github.io/js-training/examples/set.js) +- [Functions](https://nan-academy.github.io/js-training/examples/functions.js) +- [Data Structures](https://nan-academy.github.io/js-training/examples/data-structures.js) +- [Get](https://nan-academy.github.io/js-training/examples/get.js) +- [Set](https://nan-academy.github.io/js-training/examples/set.js) ### Code provided -> all code provided will be added to your solution and doesn't need to be submited. +> The provided code will be added to your solution, and does not need to be submitted. ```js const sourceObject = { From 3f4a55f605f997b2bc755cca8c1a7ff23021f966 Mon Sep 17 00:00:00 2001 From: davhojt Date: Sun, 1 May 2022 14:51:16 +0100 Subject: [PATCH 10/26] docs(dog-years): correct grammar --- subjects/dog-years/README.md | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/subjects/dog-years/README.md b/subjects/dog-years/README.md index 51d5e3ca8..db6f6915f 100644 --- a/subjects/dog-years/README.md +++ b/subjects/dog-years/README.md @@ -2,20 +2,19 @@ ### Instructions -Someone once said that a dog makes 7 years for each human year. +Someone once said that a human year is equal to 7 dog years. -Create a `dogYears` function that if given a planet name and an age in seconds, -calculates how old a dog would be on the given planet. +Create a function named `dogYears`, that accepts the name of a planet, and the age of the dog in seconds. Your function should return the age of the dog on that planet in dog years. -- `earth` : orbital period 1.0 Earth years, 365.25 Earth days, or 31,557,600 seconds -- `mercury` : orbital period 0.2408467 Earth years -- `venus` : orbital period 0.61519726 Earth years -- `mars` : orbital period 1.8808158 Earth years -- `jupiter` : orbital period 11.862615 Earth years -- `saturn` : orbital period 29.447498 Earth years -- `uranus` : orbital period 84.016846 Earth years -- `neptune` : orbital period 164.79132 Earth years +- `earth`: orbital period 1.0 Earth years, 365.25 Earth days, or 31,557,600 seconds. +- `mercury`: orbital period 0.2408467 Earth years. +- `venus`: orbital period 0.61519726 Earth years. +- `mars`: orbital period 1.8808158 Earth years. +- `jupiter`: orbital period 11.862615 Earth years. +- `saturn`: orbital period 29.447498 Earth years. +- `uranus`: orbital period 84.016846 Earth years. +- `neptune`: orbital period 164.79132 Earth years. -So if you were told someone that their dog were 1,000,000,000 seconds old, you should be able to say that the dog is 221.82 Earth-years old. +If you were told that a dog was 1,000,000,000 seconds old, you should calculate that the dog would be 221.82 Earth-years old. You will have to format the number so that the result is rounded like the example above. From 2289c0047c9cfc64941dedb032dea49ff1be87b1 Mon Sep 17 00:00:00 2001 From: davhojt Date: Sun, 1 May 2022 14:53:46 +0100 Subject: [PATCH 11/26] docs(circular): correct grammar --- subjects/circular/README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/subjects/circular/README.md b/subjects/circular/README.md index 6b06c824e..d9ff01b95 100644 --- a/subjects/circular/README.md +++ b/subjects/circular/README.md @@ -2,11 +2,10 @@ ### Instructions -Create an object named `circular` that has a property named `circular` with -itself as the value +Create an object named `circular` that has a property named `circular` with itself as the value. ### Notions -- [nan-academy.github.io/js-training/examples/data-structures.js](https://nan-academy.github.io/js-training/examples/data-structures.js) -- [nan-academy.github.io/js-training/examples/get.js](https://nan-academy.github.io/js-training/examples/get.js) -- [nan-academy.github.io/js-training/examples/set.js](https://nan-academy.github.io/js-training/examples/set.js) +- [Data Structures.js](https://nan-academy.github.io/js-training/examples/data-structures.js) +- [Get](https://nan-academy.github.io/js-training/examples/get.js) +- [Set](https://nan-academy.github.io/js-training/examples/set.js) From 9ace714473952e1bc089a2ed53e9417d5b01655f Mon Sep 17 00:00:00 2001 From: davhojt Date: Sun, 1 May 2022 14:54:12 +0100 Subject: [PATCH 12/26] docs(circular): correct grammar --- subjects/circular/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subjects/circular/README.md b/subjects/circular/README.md index d9ff01b95..d06dbd54b 100644 --- a/subjects/circular/README.md +++ b/subjects/circular/README.md @@ -6,6 +6,7 @@ Create an object named `circular` that has a property named `circular` with itse ### Notions -- [Data Structures.js](https://nan-academy.github.io/js-training/examples/data-structures.js) +- [Data Structures](https://nan-academy.github.io/js-training/examples/data-structures.js) - [Get](https://nan-academy.github.io/js-training/examples/get.js) -- [Set](https://nan-academy.github.io/js-training/examples/set.js) +- [Sets +](https://nan-academy.github.io/js-training/examples/set.js) From 8a7eb9cb7bc81681d9b58030cfed533767749377 Mon Sep 17 00:00:00 2001 From: davhojt Date: Sun, 1 May 2022 14:59:42 +0100 Subject: [PATCH 13/26] docs(biggie-smalls): correct grammar --- subjects/biggie-smalls/README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/subjects/biggie-smalls/README.md b/subjects/biggie-smalls/README.md index 248122750..78a278a4f 100644 --- a/subjects/biggie-smalls/README.md +++ b/subjects/biggie-smalls/README.md @@ -2,11 +2,10 @@ ### Instructions -Create 2 variables - -- `smalls` with the smallest possible `number` value -- `biggie` with the greatest possible `number` value +Create 2 variables: +- `smalls` with the smallest possible `number` value. +- `biggie` with the greatest possible `number` value. ### Notions -- [devdocs.io/javascript-number](https://devdocs.io/javascript-number/) +- [Number](https://devdocs.io/javascript-number/) From 606eaaa0d5106a22ec773c03fc99aefe76924f65 Mon Sep 17 00:00:00 2001 From: davhojt Date: Sun, 1 May 2022 16:05:45 +0100 Subject: [PATCH 14/26] docs(method-man): correct grammar --- subjects/method-man/README.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/subjects/method-man/README.md b/subjects/method-man/README.md index 369bcfa9d..e1ac00298 100644 --- a/subjects/method-man/README.md +++ b/subjects/method-man/README.md @@ -4,16 +4,12 @@ Write 5 functions: -- `words` that takes a string - and split it into an array of strings on spaces -- `sentence` that takes an array of strings and join them with spaces -- `yell` that take a string and return it in upper case -- `whisper` that take a string and return it in lower case - and surround it with `*` -- Create a `capitalize` function that takes a string - and transforms it to upper case only for the first letter, - and in lowercase for the rest of the string +- `words`: that takes a string, splits it by spaces, and returns an array of those substrings. +- `sentence`: that takes an array of strings, and joins them with spaces to return a single string. +- `yell`: that takes a string and returns it in upper case. +- `whisper`: that takes a string and returns it in lower case, surrounded by `*`. +- `capitalize`: that takes a string and transforms it so that the first character is upper case, and the subsequent characters are lower case. ### Notions -- [nan-academy.github.io/js-training/examples/methods.js](https://nan-academy.github.io/js-training/examples/methods.js) +- [Methods](https://nan-academy.github.io/js-training/examples/methods.js) From c4afeee6a10c72b0f34932645bcf3e79d6621910 Mon Sep 17 00:00:00 2001 From: davhojt Date: Sun, 1 May 2022 16:14:20 +0100 Subject: [PATCH 15/26] docs(abs): correct grammar --- subjects/abs/README.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/subjects/abs/README.md b/subjects/abs/README.md index f329eac78..c3954f5bc 100644 --- a/subjects/abs/README.md +++ b/subjects/abs/README.md @@ -2,23 +2,19 @@ ### Instructions -Create a `isPositive` function that takes a number as -parameter and return true if the given number is -stricly positive, or false otherwise +Create a function named `isPositive` that takes a number as a argument, returning `true` if the number is strictly positive, and `false` otherwise. -Create the `abs` function that takes one number argument -and returns its absolute value. -You are not allowed to use `Math.abs`, make your own. +Create a function named `abs` that takes a number as an argument and returns its absolute value. You must make your own implementation. You **must not** use `Math.abs()`. ### Notions -- [nan-academy.github.io/js-training/examples/functions.js](https://nan-academy.github.io/js-training/examples/functions.js) -- [nan-academy.github.io/js-training/examples/ternary.js](https://nan-academy.github.io/js-training/examples/ternary.js) -- [devdocs.io/javascript/global_objects/math/abs](https://devdocs.io/javascript/global_objects/math/abs) +- [Functions](https://nan-academy.github.io/js-training/examples/functions.js) +- [Ternary](https://nan-academy.github.io/js-training/examples/ternary.js) +- [Math.abs](https://devdocs.io/javascript/global_objects/math/abs) ### Code provided -> all code provided will be added to your solution and does not need to be submited. +> The provided code will be added to your solution, and does not need to be submitted. ```js Math.abs = undefined From c8efa721550684ee461e928b86a956d7637e6e3d Mon Sep 17 00:00:00 2001 From: davhojt Date: Sun, 1 May 2022 16:19:28 +0100 Subject: [PATCH 16/26] docs(min-max): correct grammar --- subjects/min-max/README.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/subjects/min-max/README.md b/subjects/min-max/README.md index 9e87c908c..c309839b9 100644 --- a/subjects/min-max/README.md +++ b/subjects/min-max/README.md @@ -2,26 +2,24 @@ ### Instructions -Create the `max` function that takes 2 number as arguments -and returns the greatest +Create a function named `max` that takes 2 number arguments and returns the largest of the two. > You must not just use `Math.max`, make your own. -Create the `min` function that takes 2 number as arguments -and returns the lowest +Create a function named `min` which is the same as `max`, but returns the lowest. > You must not just use `Math.min`, make your own. ### Notions -- [nan-academy.github.io/js-training/examples/functions](https://nan-academy.github.io/js-training/examples/functions.js) -- [nan-academy.github.io/js-training/examples/ternary](https://nan-academy.github.io/js-training/examples/ternary.js) -- [devdocs.io/javascript/global_objects/math/min](https://devdocs.io/javascript/global_objects/math/min) -- [devdocs.io/javascript/global_objects/math/max](https://devdocs.io/javascript/global_objects/math/max) +- [Functions](https://nan-academy.github.io/js-training/examples/functions.js) +- [Ternary](https://nan-academy.github.io/js-training/examples/ternary.js) +- [Math.min](https://devdocs.io/javascript/global_objects/math/min) +- [Math.max](https://devdocs.io/javascript/global_objects/math/max) ### Code provided -> all code provided will be added to your solution and doesn't need to be submited. +> The provided code will be added to your solution, and does not need to be submitted. ```js Math.min = Math.max = undefined From 324a3a19833ff43e83b6d1209e37568795eb8939 Mon Sep 17 00:00:00 2001 From: davhojt Date: Sun, 1 May 2022 16:22:55 +0100 Subject: [PATCH 17/26] docs(sign): correct grammar --- subjects/sign/README.md | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/subjects/sign/README.md b/subjects/sign/README.md index 2bfe5519a..d4ba02211 100644 --- a/subjects/sign/README.md +++ b/subjects/sign/README.md @@ -2,23 +2,20 @@ ### Instructions -Create the `sign` function that takes one number argument -and return 1 if the number is positive, -1 if the number is negative -and 0 if the number is exactly 0 -You must not just use `Math.sign`, make your own. +Create a function named `sign` that takes one number argument; returning `1` if the number is positive, `-1` if the number is negative and `0` if the number is exactly 0. +> You must not just use `Math.sign`, make your own. -Create the `sameSign` function that takes 2 numbers as arguments and return true -if they both have the same sign, or false otherwise. +Create a function named `sameSign` that takes 2 numbers as arguments and returns `true` if they both have the same sign, or false otherwise. ### Notions -- [nan-academy.github.io/js-training/examples/functions](https://nan-academy.github.io/js-training/examples/functions.js) -- [nan-academy.github.io/js-training/examples/if-else](https://nan-academy.github.io/js-training/examples/if-else.js) -- [devdocs.io/javascript/global_objects/math/sign](https://devdocs.io/javascript/global_objects/math/sign) +- [Functions](https://nan-academy.github.io/js-training/examples/functions.js) +- [If-else](https://nan-academy.github.io/js-training/examples/if-else.js) +- [Math.sign](https://devdocs.io/javascript/global_objects/math/sign) ### Code provided -> all code provided will be added to your solution and doesn't need to be submited. +> The provided code will be added to your solution, and does not need to be submitted. ```js Math.sign = undefined From 5f352f1da2cff3c5d5073cb55142290b84a0f3ff Mon Sep 17 00:00:00 2001 From: davhojt Date: Sun, 1 May 2022 16:28:27 +0100 Subject: [PATCH 18/26] docs(is): correct grammar --- subjects/is/README.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/subjects/is/README.md b/subjects/is/README.md index 51ae1503a..bedc11021 100644 --- a/subjects/is/README.md +++ b/subjects/is/README.md @@ -2,30 +2,30 @@ ### Instructions -Add new function properties to the object `is` to check a value type - -- `is.num` value is a number -- `is.nan` value is NaN -- `is.str` value is a string -- `is.bool` value is a boolean -- `is.undef` value is undefined -- `is.def` value is defined -- `is.arr` value is an array -- `is.obj` value is a simple object or null objects -- `is.fun` value is a function -- `is.truthy` value is truthy -- `is.falsy` value is falsy +Add new function properties to the `is` object to check value types. Each function should take one argument, and return a `boolean`. + +- `is.num`: value is a `number`. +- `is.nan`: value is `NaN`. +- `is.str`: value is a `string`. +- `is.bool`: value is a `boolean`. +- `is.undef`: value is `undefined`. +- `is.def`: value is defined. +- `is.arr`: value is an `array`. +- `is.obj`: value is a simple object or `null` objects. +- `is.fun`: value is a function. +- `is.truthy`: value is truthy. +- `is.falsy`: value is falsy. ### Notions -- [nan-academy.github.io/js-training/examples/primitive-and-operators](https://nan-academy.github.io/js-training/examples/primitive-and-operators.js) -- [devdocs.io/javascript/operators/typeof](https://devdocs.io/javascript/operators/typeof) -- [developer.mozilla.org/en-US/docs/Glossary/Truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) -- [developer.mozilla.org/en-US/docs/Glossary/Falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) +- [Primitives and operators](https://nan-academy.github.io/js-training/examples/primitive-and-operators.js) +- [typeof](https://devdocs.io/javascript/operators/typeof) +- [Truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) +- [Falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) ### Code provided -> all code provided will be added to your solution and doesn't need to be submited. +> The provided code will be added to your solution, and does not need to be submitted. ```js const is = {} From 250e4031c79a4266b07259f668b8b328f7fb823b Mon Sep 17 00:00:00 2001 From: davhojt Date: Sun, 1 May 2022 16:38:18 +0100 Subject: [PATCH 19/26] docs(physics): correct grammar --- subjects/physics/README.md | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/subjects/physics/README.md b/subjects/physics/README.md index 420aa3782..ccd3a1f5b 100644 --- a/subjects/physics/README.md +++ b/subjects/physics/README.md @@ -3,10 +3,12 @@ ### Instructions Isaac Newton has forgotten his laws of physics and needs your help to animate an object on his game. -He must use the Second Law of Motion that states, when the forces acting on an object are unbalanced, the object will accelerate. -This acceleration is dependent upon the force that act upon the object and the object's mass. -So he wants to know for an object with : +He must use the Second Law of Motion that states, "when the forces acting on an object are unbalanced, the object will accelerate." + +This acceleration is dependent upon the force that acts upon the object and the object's mass. + +So he wants to know what the acceleration of that object is, depending on its properties: - mass of xx - Δv of xx @@ -15,9 +17,18 @@ So he wants to know for an object with : - distance xx - time xx -whats the acceleration of that object. -Create a function called `getAcceleration` that given an object with the values of `{ f: 10, m: 5, Δv: 100, Δt: 50, t:1, d: 10 }` -it must calculate the acceleration. If its not possible to calculate it you must return the string `impossible` +Create a function named `getAcceleration` that calculates the velocity of a given object. For example: +```js +{ + f: 10, + m: 5, + Δv: 100, + Δt: 50, + t:1, + d: 10 +} +``` +If its not possible to calculate it, it must return the string `"impossible"`. ### Formulas @@ -27,6 +38,7 @@ a = Δv/Δt a = 2d/t^2 a = acceleration +m = mass F = force Δv = final velocity - initial velocity Δt = final time - initial time @@ -36,6 +48,6 @@ t = time ### Quote -Truth is ever to be found in simplicity, and not in the multiplicity and confusion of things +_"Truth is ever to be found in simplicity, and not in the multiplicity and confusion of things."_ Isaac Newton From f311bdd6032f14c1b097a0193e4aa216866a01ab Mon Sep 17 00:00:00 2001 From: davhojt Date: Sun, 1 May 2022 16:56:29 +0100 Subject: [PATCH 20/26] docs(collections): correct grammar --- subjects/collections/README.md | 41 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/subjects/collections/README.md b/subjects/collections/README.md index 0914cb0a2..7142e48ff 100644 --- a/subjects/collections/README.md +++ b/subjects/collections/README.md @@ -2,22 +2,21 @@ ### Instructions -Write a bunch of function to move from one type to another +Write a bunch of functions which converts data from one type to another: -- `arrToSet` from `Array` to `Set` -- `arrToStr` from `Array` to `String` -- `setToArr` from `Set` to `Array` -- `setToStr` from `Set` to `String` -- `strToArr` from `String` to `Array` -- `strToSet` from `String` to `Set` -- `mapToObj` from `Map` to `Object` -- `objToArr` from `Object` to `Array` -- `objToMap` from `Object` to `Map` -- `arrToObj` from `Array` to `Object` -- `strToObj` from `String` to `Object` +- `arrToSet` from `Array` to `Set`. +- `arrToStr` from `Array` to `string`. +- `setToArr` from `Set` to `Array`. +- `setToStr` from `Set` to `string`. +- `strToArr` from `string` to `Array`. +- `strToSet` from `string` to `Set`. +- `mapToObj` from `Map` to `Object`. +- `objToArr` from `Object` to `Array`. +- `objToMap` from `Object` to `Map`. +- `arrToObj` from `Array` to `Object`. +- `strToObj` from `string` to `Object`. -and finally write a function `superTypeOf` that unlike `typeof` return -a different value for advanced types like `Map` and `Set` +Finally, write a function named `superTypeOf` that unlike `typeof` returns a specific values for advanced types like `Map` and `Set`. ### Examples @@ -37,7 +36,7 @@ map.set(3, 'c') map.set(4, 'd') arrToSet(arr) // -> Set { 1, 2, 3 } -arrToStr(arr) // -> '1213' +arrToStr(arr) // -> '123' setToArr(set) // -> [1, 2, 3] setToStr(set) // -> '123' strToArr(str) // -> ['h', 'e', 'l', 'l', 'o'] @@ -62,9 +61,9 @@ superTypeOf(superTypeOf) // -> 'Function' ### Notions -- [devdocs.io/javascript/operators/typeof](https://devdocs.io/javascript/operators/typeof) -- [devdocs.io/javascript/operators/spread_syntax](https://devdocs.io/javascript/operators/spread_syntax) -- [devdocs.io/javascript/global_objects/map](https://devdocs.io/javascript/global_objects/map) -- [devdocs.io/javascript/global_objects/set](https://devdocs.io/javascript/global_objects/set) -- [devdocs.io/javascript/global_objects/object/fromentries](https://devdocs.io/javascript/global_objects/object/fromentries) -- [devdocs.io/javascript/global_objects/object/entries](https://devdocs.io/javascript/global_objects/object/entries) +- [typeof](https://devdocs.io/javascript/operators/typeof) +- [Sspread syntax](https://devdocs.io/javascript/operators/spread_syntax) +- [Map](https://devdocs.io/javascript/global_objects/map) +- [Set](https://devdocs.io/javascript/global_objects/set) +- [Object.fromEntries](https://devdocs.io/javascript/global_objects/object/fromentries) +- [Object.entries](https://devdocs.io/javascript/global_objects/object/entries) From ccb6545be59a813605ff3a7a8cbc752e01405bc0 Mon Sep 17 00:00:00 2001 From: davhojt Date: Sun, 1 May 2022 16:59:27 +0100 Subject: [PATCH 21/26] docs(collections): correct grammar --- subjects/collections/README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/subjects/collections/README.md b/subjects/collections/README.md index 7142e48ff..4b1d39008 100644 --- a/subjects/collections/README.md +++ b/subjects/collections/README.md @@ -4,17 +4,17 @@ Write a bunch of functions which converts data from one type to another: -- `arrToSet` from `Array` to `Set`. -- `arrToStr` from `Array` to `string`. -- `setToArr` from `Set` to `Array`. -- `setToStr` from `Set` to `string`. -- `strToArr` from `string` to `Array`. -- `strToSet` from `string` to `Set`. -- `mapToObj` from `Map` to `Object`. -- `objToArr` from `Object` to `Array`. -- `objToMap` from `Object` to `Map`. -- `arrToObj` from `Array` to `Object`. -- `strToObj` from `string` to `Object`. +- `arrToSet`: from `Array` to `Set`. +- `arrToStr`: from `Array` to `string`. +- `setToArr`: from `Set` to `Array`. +- `setToStr`: from `Set` to `string`. +- `strToArr`: from `string` to `Array`. +- `strToSet`: from `string` to `Set`. +- `mapToObj`: from `Map` to `Object`. +- `objToArr`: from `Object` to `Array`. +- `objToMap`: from `Object` to `Map`. +- `arrToObj`: from `Array` to `Object`. +- `strToObj`: from `string` to `Object`. Finally, write a function named `superTypeOf` that unlike `typeof` returns a specific values for advanced types like `Map` and `Set`. From d2bd65bb7834ff36fe28038bb72c460743d37593 Mon Sep 17 00:00:00 2001 From: davhojt Date: Sun, 1 May 2022 17:19:46 +0100 Subject: [PATCH 22/26] docs(block-chain): correct grammar --- subjects/block-chain/README.md | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/subjects/block-chain/README.md b/subjects/block-chain/README.md index 4d3b8d80a..cac9df893 100644 --- a/subjects/block-chain/README.md +++ b/subjects/block-chain/README.md @@ -2,22 +2,18 @@ ### Instructions -Create a `blockChain` that create a block in your very own block chain. +Create a function named `blockChain` that creates a block in your very own block chain. It takes 2 arguments: -the function takes 2 arguments: - -- `data` any valid JSON data -- `prev` the previous block, if no block are given it should use the - genesis block: `{ index: 0, hash: '0' }` +- `data`: any valid JSON data. +- `prev`: the previous block, if no block are given it should use the genesis block: `{ index: 0, hash: '0' }`. A block must have the following properties: - `index` -- `hash` a computed hash using the concatenation of the `index`, `hash` - and stringified `data` and hashing all of it using the provided `hashCode`. -- `data` the data (not encoded in JSON) -- `prev` the previous block -- `chain` a function that takes a new `data` and create the next block with it. +- `hash`: a computed hash using the `hashCode` function provided. You will need to pass it a concatenation of the block's `index`, the previous block's `hash` and the block's stringified `data`. +- `data`: any valid JSON object. +- `prev`: the previous block. +- `chain`: a function that accepts `data` as an argument, and creates the next block with it. ### Examples @@ -51,11 +47,11 @@ console.log(fork.index) // -> 5 ### Notions -- [devdocs.io/javascript/global_objects/json/stringify](https://devdocs.io/javascript/global_objects/json/stringify) +- [JSON.stringify](https://devdocs.io/javascript/global_objects/json/stringify) ### Code provided -> all code provided will be added to your solution and doesn't need to be submited. +> The provided code will be added to your solution, and does not need to be submitted. ```js const hashCode = str => From c9a5c7c7d4ba6e32a9e5cee0a3e132760ffe7fe2 Mon Sep 17 00:00:00 2001 From: davhojt Date: Wed, 4 May 2022 18:27:04 +0100 Subject: [PATCH 23/26] fix(collections): correct typo --- subjects/collections/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subjects/collections/README.md b/subjects/collections/README.md index 4b1d39008..0add98506 100644 --- a/subjects/collections/README.md +++ b/subjects/collections/README.md @@ -62,7 +62,7 @@ superTypeOf(superTypeOf) // -> 'Function' ### Notions - [typeof](https://devdocs.io/javascript/operators/typeof) -- [Sspread syntax](https://devdocs.io/javascript/operators/spread_syntax) +- [Spread syntax](https://devdocs.io/javascript/operators/spread_syntax) - [Map](https://devdocs.io/javascript/global_objects/map) - [Set](https://devdocs.io/javascript/global_objects/set) - [Object.fromEntries](https://devdocs.io/javascript/global_objects/object/fromentries) From ce7a836d7af4687ce653584bea8fcb830c8f9c5f Mon Sep 17 00:00:00 2001 From: davhojt Date: Thu, 5 May 2022 11:47:36 +0100 Subject: [PATCH 24/26] fix(collections): correct arrToStr output --- subjects/collections/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subjects/collections/README.md b/subjects/collections/README.md index 0add98506..d471553d5 100644 --- a/subjects/collections/README.md +++ b/subjects/collections/README.md @@ -36,7 +36,7 @@ map.set(3, 'c') map.set(4, 'd') arrToSet(arr) // -> Set { 1, 2, 3 } -arrToStr(arr) // -> '123' +arrToStr(arr) // -> '1213' setToArr(set) // -> [1, 2, 3] setToStr(set) // -> '123' strToArr(str) // -> ['h', 'e', 'l', 'l', 'o'] From ff3f9be5f98e294cf2011aa9289b90a2077b3a2b Mon Sep 17 00:00:00 2001 From: davhojt Date: Thu, 5 May 2022 11:49:08 +0100 Subject: [PATCH 25/26] fix(circular): remove extra line --- subjects/circular/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/subjects/circular/README.md b/subjects/circular/README.md index d06dbd54b..7cc6dba2b 100644 --- a/subjects/circular/README.md +++ b/subjects/circular/README.md @@ -8,5 +8,4 @@ Create an object named `circular` that has a property named `circular` with itse - [Data Structures](https://nan-academy.github.io/js-training/examples/data-structures.js) - [Get](https://nan-academy.github.io/js-training/examples/get.js) -- [Sets -](https://nan-academy.github.io/js-training/examples/set.js) +- [Sets](https://nan-academy.github.io/js-training/examples/set.js) From 0d2116bbec42231ee0960858757972d88c0ee07c Mon Sep 17 00:00:00 2001 From: davhojt Date: Thu, 5 May 2022 12:05:37 +0100 Subject: [PATCH 26/26] fix(block-chain): improve description of data --- subjects/block-chain/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subjects/block-chain/README.md b/subjects/block-chain/README.md index cac9df893..3ecf148a7 100644 --- a/subjects/block-chain/README.md +++ b/subjects/block-chain/README.md @@ -11,7 +11,7 @@ A block must have the following properties: - `index` - `hash`: a computed hash using the `hashCode` function provided. You will need to pass it a concatenation of the block's `index`, the previous block's `hash` and the block's stringified `data`. -- `data`: any valid JSON object. +- `data`: any valid object. - `prev`: the previous block. - `chain`: a function that accepts `data` as an argument, and creates the next block with it.