forked from root/public
38 changed files with 887 additions and 891 deletions
@ -1,92 +1,92 @@
|
||||
## How to do an audit from home |
||||
|
||||
### Introduction |
||||
|
||||
A little reminder first, |
||||
|
||||
Audits, as we have told you many times, are an essential part of leveling up and truly acquiring your skills |
||||
and knowledge. |
||||
|
||||
Normally, they must be done with your physical presence. |
||||
The idea is that they encourage the exchange between the auditors and the members of the group. |
||||
|
||||
If the project fails, the whole group will learn why. And then after all your audits are done you will retry. |
||||
During all those extra audits, you, as a group, will discuss about your failures with the auditors. |
||||
If the project succeed, you will be an inspiration for the auditors. |
||||
In both of those cases you will learn or you will teach. The roles will keep reversing almost every time. |
||||
|
||||
It is, ultimaly, those interactions that are essential for really learning; |
||||
To give and receive feedback, but also to see what you really know as an individual and what you do not. |
||||
This will increase your capacity to solve problems and your capacity to adapt, which is one of the most important |
||||
skill of a good programmer. |
||||
|
||||
Today, once again, we must adapt... |
||||
Knowledge is important but not as essential as health. |
||||
|
||||
We really wish all of you to stay safe and healthy at home. |
||||
|
||||
This is why we created a little guideline in how to conduct your audit from home. |
||||
There is a video here : [youtube.com/watch?v=J8g8P-IJLJw](https://www.youtube.com/watch?v=J8g8P-IJLJw) |
||||
|
||||
But we are also going to summarize the process. |
||||
So here we go. |
||||
|
||||
### Prerequisites for the team captain and the auditor |
||||
|
||||
- A program to communicate and livestream installed (like Discord [https://discordapp.com/](https://discordapp.com/) ) |
||||
- A program to allows the auditor to take charge of the computer |
||||
of the team captain installed (like teamViewer [teamviewer.com/](https://www.teamviewer.com/) ) |
||||
|
||||
### Prerequisite for the team captain |
||||
|
||||
The team captain must communicate : |
||||
|
||||
- The contact of his or her teammates to the auditor |
||||
- The git repository of the project to be reviewed (the link must be public or accessible for the auditor) |
||||
- The team captain must be logged in in his or her session to allow the auditor to start its audit |
||||
|
||||
### Prerequisite for the auditor |
||||
|
||||
- The auditor will need to create the group on the communication program |
||||
- The auditor will need to download the project repository |
||||
- The auditor, if the internet bandwith allows it, will livestream the process |
||||
|
||||
### Instructions |
||||
|
||||
1. Let the auditor establish the communication with the group members and the captain. |
||||
|
||||
2. Once all prequisites are done from the team captain and the auditor let the audit begin. |
||||
|
||||
3. If possible, the auditor starts the stream. |
||||
|
||||
4. The captain, after checking that the login is done on his or her computer, allows the auditor |
||||
to take control of its computer (with teamViewer for example) |
||||
|
||||
5. The auditor now has the control to start the audit on the computer of the captain. |
||||
The organization of the windows by the auditor might be the tricky part. We suggest |
||||
to see how we did it in the video if you find it difficult. |
||||
|
||||
6. The auditor conducts the audit, if the auditor can not live stream its audits, he or she |
||||
will then explain by voice (or writing in the chat) what he or she is doing to the rest of the group. |
||||
|
||||
7. The audit is conducted until all questions are validated or until a mistake is made. |
||||
|
||||
8. If a mistake is made the auditor can copy paste the commands that detected the mistakes. |
||||
|
||||
9. The group discusses as much as needed until the audit is completed. |
||||
|
||||
10. Once the audit is completed, all programs can be closed up. Say bye and thank you for your time and make the |
||||
necessary conclusions among the members of the group. |
||||
|
||||
### Conclusion |
||||
|
||||
Thank you for reading until the end. Stay safe. |
||||
|
||||
### Bonus |
||||
|
||||
Did you know that there is a nice `Live Share` extension on `vscode`? |
||||
This allows to do remote group programming easily. It might be an alternative solution |
||||
to the livestream if necessary. |
||||
Try it out! |
||||
|
||||
Stay safe everyone! Happy coding! |
||||
## How to do an audit from home |
||||
|
||||
### Introduction |
||||
|
||||
A little reminder first, |
||||
|
||||
Audits, as we have told you many times, are an essential part of leveling up and truly acquiring your skills |
||||
and knowledge. |
||||
|
||||
Normally, they must be done with your physical presence. |
||||
The idea is that they encourage the exchange between the auditors and the members of the group. |
||||
|
||||
If the project fails, the whole group will learn why. And then after all your audits are done you will retry. |
||||
During all those extra audits, you, as a group, will discuss about your failures with the auditors. |
||||
If the project succeed, you will be an inspiration for the auditors. |
||||
In both of those cases you will learn or you will teach. The roles will keep reversing almost every time. |
||||
|
||||
It is, ultimaly, those interactions that are essential for really learning; |
||||
To give and receive feedback, but also to see what you really know as an individual and what you do not. |
||||
This will increase your capacity to solve problems and your capacity to adapt, which is one of the most important |
||||
skill of a good programmer. |
||||
|
||||
Today, once again, we must adapt... |
||||
Knowledge is important but not as essential as health. |
||||
|
||||
We really wish all of you to stay safe and healthy at home. |
||||
|
||||
This is why we created a little guideline in how to conduct your audit from home. |
||||
There is a video here : [youtube.com/watch?v=J8g8P-IJLJw](https://www.youtube.com/watch?v=J8g8P-IJLJw) |
||||
|
||||
But we are also going to summarize the process. |
||||
So here we go. |
||||
|
||||
### Prerequisites for the team captain and the auditor |
||||
|
||||
- A program to communicate and livestream installed (like Discord [discordapp.com](https://discordapp.com/) ) |
||||
- A program to allows the auditor to take charge of the computer |
||||
of the team captain installed (like teamViewer [teamviewer.com](https://www.teamviewer.com/) ) |
||||
|
||||
### Prerequisite for the team captain |
||||
|
||||
The team captain must communicate : |
||||
|
||||
- The contact of his or her teammates to the auditor |
||||
- The git repository of the project to be reviewed (the link must be public or accessible for the auditor) |
||||
- The team captain must be logged in in his or her session to allow the auditor to start its audit |
||||
|
||||
### Prerequisite for the auditor |
||||
|
||||
- The auditor will need to create the group on the communication program |
||||
- The auditor will need to download the project repository |
||||
- The auditor, if the internet bandwith allows it, will livestream the process |
||||
|
||||
### Instructions |
||||
|
||||
1. Let the auditor establish the communication with the group members and the captain. |
||||
|
||||
2. Once all prequisites are done from the team captain and the auditor let the audit begin. |
||||
|
||||
3. If possible, the auditor starts the stream. |
||||
|
||||
4. The captain, after checking that the login is done on his or her computer, allows the auditor |
||||
to take control of its computer (with teamViewer for example) |
||||
|
||||
5. The auditor now has the control to start the audit on the computer of the captain. |
||||
The organization of the windows by the auditor might be the tricky part. We suggest |
||||
to see how we did it in the video if you find it difficult. |
||||
|
||||
6. The auditor conducts the audit, if the auditor can not live stream its audits, he or she |
||||
will then explain by voice (or writing in the chat) what he or she is doing to the rest of the group. |
||||
|
||||
7. The audit is conducted until all questions are validated or until a mistake is made. |
||||
|
||||
8. If a mistake is made the auditor can copy paste the commands that detected the mistakes. |
||||
|
||||
9. The group discusses as much as needed until the audit is completed. |
||||
|
||||
10. Once the audit is completed, all programs can be closed up. Say bye and thank you for your time and make the |
||||
necessary conclusions among the members of the group. |
||||
|
||||
### Conclusion |
||||
|
||||
Thank you for reading until the end. Stay safe. |
||||
|
||||
### Bonus |
||||
|
||||
Did you know that there is a nice `Live Share` extension on `vscode`? |
||||
This allows to do remote group programming easily. It might be an alternative solution |
||||
to the livestream if necessary. |
||||
Try it out! |
||||
|
||||
Stay safe everyone! Happy coding! |
||||
|
@ -1,12 +1,12 @@
|
||||
## Biggie Smalls |
||||
|
||||
### Instructions |
||||
|
||||
Create 2 variables |
||||
- `smalls` with the smallest possible number value |
||||
- `biggie` with the greatest possible number value |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://devdocs.io/javascript-number/](https://devdocs.io/javascript-number/) |
||||
## Biggie Smalls |
||||
|
||||
### Instructions |
||||
|
||||
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/) |
||||
|
@ -1,33 +1,33 @@
|
||||
## Change |
||||
|
||||
### Instructions |
||||
|
||||
Create 2 functions: |
||||
- `get`: a function that takes a key and return 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 |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://nan-academy.github.io/js-training/examples/functions.js](https://nan-academy.github.io/js-training/examples/functions.js) |
||||
- [https://nan-academy.github.io/js-training/examples/data-structures.js](https://nan-academy.github.io/js-training/examples/data-structures.js) |
||||
- [https://nan-academy.github.io/js-training/examples/get.js](https://nan-academy.github.io/js-training/examples/get.js) |
||||
- [https://nan-academy.github.io/js-training/examples/set.js](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. |
||||
|
||||
```js |
||||
const sourceObject = { |
||||
num: 42, |
||||
bool: true, |
||||
str: 'some text', |
||||
log: console.log, |
||||
} |
||||
``` |
||||
## Change |
||||
|
||||
### Instructions |
||||
|
||||
Create 2 functions: |
||||
- `get`: a function that takes a key and return 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 |
||||
|
||||
|
||||
### 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) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
const sourceObject = { |
||||
num: 42, |
||||
bool: true, |
||||
str: 'some text', |
||||
log: console.log, |
||||
} |
||||
``` |
||||
|
@ -1,13 +1,13 @@
|
||||
## Circular |
||||
|
||||
### Instructions |
||||
|
||||
Create an object named `circular` that has a property named `circular` with |
||||
itself as the value |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://nan-academy.github.io/js-training/examples/data-structures.js](https://nan-academy.github.io/js-training/examples/data-structures.js) |
||||
- [https://nan-academy.github.io/js-training/examples/get.js](https://nan-academy.github.io/js-training/examples/get.js) |
||||
- [https://nan-academy.github.io/js-training/examples/set.js](https://nan-academy.github.io/js-training/examples/set.js) |
||||
## Circular |
||||
|
||||
### Instructions |
||||
|
||||
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) |
||||
|
@ -1,21 +1,21 @@
|
||||
## Currify |
||||
|
||||
### Instructions |
||||
|
||||
Create the function `currify` that will curry any functions put as argument. |
||||
|
||||
example: |
||||
```js |
||||
const mult2 = (el1,el2) => el1 * el2 |
||||
console.log(mult2(2,2)) // result epected 4 |
||||
|
||||
|
||||
const mult2Curried = currify(mult2) |
||||
|
||||
console.log(mult2Curried(2)(2)) // result expected 4 |
||||
// (same result, with a function that has technically only one argument) |
||||
``` |
||||
|
||||
### Notions |
||||
|
||||
- [https://stackoverflow.com/questions/36314/what-is-currying](https://stackoverflow.com/questions/36314/what-is-currying) |
||||
## Currify |
||||
|
||||
### Instructions |
||||
|
||||
Create the function `currify` that will curry any functions put as argument. |
||||
|
||||
example: |
||||
```js |
||||
const mult2 = (el1,el2) => el1 * el2 |
||||
console.log(mult2(2,2)) // result epected 4 |
||||
|
||||
|
||||
const mult2Curried = currify(mult2) |
||||
|
||||
console.log(mult2Curried(2)(2)) // result expected 4 |
||||
// (same result, with a function that has technically only one argument) |
||||
``` |
||||
|
||||
### Notions |
||||
|
||||
- [stackoverflow.com/questions/36314/what-is-currying](https://stackoverflow.com/questions/36314/what-is-currying) |
||||
|
@ -1,48 +1,48 @@
|
||||
## Curry Entries |
||||
|
||||
### Instructions |
||||
|
||||
This exercise consists in creating curry functions to apply in the objects |
||||
entries. |
||||
You will have to create the following curry functions: |
||||
|
||||
- `defaultCurry` that will curry two objects in witch the second object must |
||||
be the default object and returns a new object with the modifications applied |
||||
by the first object |
||||
- `mapCurry` that replicate the function `.map` |
||||
- `reduceCurry` that replicate the function `.reduce` |
||||
- `filterCurry` that replicate the function `.filter` |
||||
|
||||
You will also have to create for each curry function the following: |
||||
|
||||
- `reduceScore` that will return the total value of the scores |
||||
of the persons who use the force |
||||
- `filterForce` that will return the force users with `shootingScores` |
||||
equal or higher than 80 |
||||
- `mapAverage` that will return a new object with the propriety `averageScore` |
||||
that is the averages of the scores for each person |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://devdocs.io/javascript/global_objects/array/filter](https://devdocs.io/javascript/global_objects/array/filter) |
||||
- [https://devdocs.io/javascript/global_objects/array/map](https://devdocs.io/javascript/global_objects/array/map) |
||||
- [https://devdocs.io/javascript/global_objects/array/reduce](https://devdocs.io/javascript/global_objects/array/reduce) |
||||
- [https://devdocs.io/javascript/global_objects/object/entries](https://devdocs.io/javascript/global_objects/object/entries) |
||||
- [https://devdocs.io/javascript/global_objects/object/fromentries](https://devdocs.io/javascript/global_objects/object/fromentries) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
// prettier-ignore |
||||
const personnel = { |
||||
lukeSkywalker: { id: 5, pilotingScore: 98, shootingScore: 56, isForceUser: true }, |
||||
sabineWren: { id: 82, pilotingScore: 73, shootingScore: 99, isForceUser: false }, |
||||
zebOrellios: { id: 22, pilotingScore: 20, shootingScore: 59, isForceUser: false }, |
||||
ezraBridger: { id: 15, pilotingScore: 43, shootingScore: 67, isForceUser: true }, |
||||
calebDume: { id: 11, pilotingScore: 71, shootingScore: 85, isForceUser: true }, |
||||
} |
||||
``` |
||||
## Curry Entries |
||||
|
||||
### Instructions |
||||
|
||||
This exercise consists in creating curry functions to apply in the objects |
||||
entries. |
||||
You will have to create the following curry functions: |
||||
|
||||
- `defaultCurry` that will curry two objects in witch the second object must |
||||
be the default object and returns a new object with the modifications applied |
||||
by the first object |
||||
- `mapCurry` that replicate the function `.map` |
||||
- `reduceCurry` that replicate the function `.reduce` |
||||
- `filterCurry` that replicate the function `.filter` |
||||
|
||||
You will also have to create for each curry function the following: |
||||
|
||||
- `reduceScore` that will return the total value of the scores |
||||
of the persons who use the force |
||||
- `filterForce` that will return the force users with `shootingScores` |
||||
equal or higher than 80 |
||||
- `mapAverage` that will return a new object with the propriety `averageScore` |
||||
that is the averages of the scores for each person |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [devdocs.io/javascript/global_objects/array/filter](https://devdocs.io/javascript/global_objects/array/filter) |
||||
- [devdocs.io/javascript/global_objects/array/map](https://devdocs.io/javascript/global_objects/array/map) |
||||
- [devdocs.io/javascript/global_objects/array/reduce](https://devdocs.io/javascript/global_objects/array/reduce) |
||||
- [devdocs.io/javascript/global_objects/object/entries](https://devdocs.io/javascript/global_objects/object/entries) |
||||
- [devdocs.io/javascript/global_objects/object/fromentries](https://devdocs.io/javascript/global_objects/object/fromentries) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
// prettier-ignore |
||||
const personnel = { |
||||
lukeSkywalker: { id: 5, pilotingScore: 98, shootingScore: 56, isForceUser: true }, |
||||
sabineWren: { id: 82, pilotingScore: 73, shootingScore: 99, isForceUser: false }, |
||||
zebOrellios: { id: 22, pilotingScore: 20, shootingScore: 59, isForceUser: false }, |
||||
ezraBridger: { id: 15, pilotingScore: 43, shootingScore: 67, isForceUser: true }, |
||||
calebDume: { id: 11, pilotingScore: 71, shootingScore: 85, isForceUser: true }, |
||||
} |
||||
``` |
||||
|
@ -1,27 +1,27 @@
|
||||
## Cut Corners |
||||
|
||||
### Instructions |
||||
|
||||
Create a function for each rounding math functions: |
||||
- round (like `Math.round`) |
||||
- ceil (like `Math.ceil`) |
||||
- floor (like `Math.floor`) |
||||
- trunc (like `Math.trunc`) |
||||
|
||||
Some restrictions apply: |
||||
- You may not use strings conversion to do it |
||||
- No bitwise operator |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://devdocs.io/javascript/global_objects/math](https://devdocs.io/javascript/global_objects/math) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
Math.round = Math.ceil = Math.floor = Math.trunc = undefined |
||||
``` |
||||
## Cut Corners |
||||
|
||||
### Instructions |
||||
|
||||
Create a function for each rounding math functions: |
||||
- round (like `Math.round`) |
||||
- ceil (like `Math.ceil`) |
||||
- floor (like `Math.floor`) |
||||
- trunc (like `Math.trunc`) |
||||
|
||||
Some restrictions apply: |
||||
- You may not use strings conversion to do it |
||||
- No bitwise operator |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [devdocs.io/javascript/global_objects/math](https://devdocs.io/javascript/global_objects/math) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
Math.round = Math.ceil = Math.floor = Math.trunc = undefined |
||||
``` |
||||
|
@ -1,19 +1,19 @@
|
||||
## Date Is |
||||
|
||||
### Instructions |
||||
|
||||
Create the following functions: |
||||
- `isValid`, this function must return false if its an Invalid Date |
||||
- `isAfter`, this function will receive two dates and return true if the first date is bigger then the second date |
||||
- `isBefore`, this function will receive two dates and return true if the first date is lesser then the second date |
||||
- `isFuture`, will return true if the date given as parameter is higher then the present date |
||||
- `isPast`, will return true if the date given as parameter less then the present date |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://date-fns.org/v2.14.0/docs/isValid](https://date-fns.org/v2.14.0/docs/isValid) |
||||
- [https://date-fns.org/v2.14.0/docs/isAfter](https://date-fns.org/v2.14.0/docs/isAfter) |
||||
- [https://date-fns.org/v2.14.0/docs/isBefore](https://date-fns.org/v2.14.0/docs/isBefore) |
||||
- [https://date-fns.org/v2.14.0/docs/isFuture](https://date-fns.org/v2.14.0/docs/isFuture) |
||||
- [https://date-fns.org/v2.14.0/docs/isPast](https://date-fns.org/v2.14.0/docs/isPast) |
||||
## Date Is |
||||
|
||||
### Instructions |
||||
|
||||
Create the following functions: |
||||
- `isValid`, this function must return false if its an Invalid Date |
||||
- `isAfter`, this function will receive two dates and return true if the first date is bigger then the second date |
||||
- `isBefore`, this function will receive two dates and return true if the first date is lesser then the second date |
||||
- `isFuture`, will return true if the date given as parameter is higher then the present date |
||||
- `isPast`, will return true if the date given as parameter less then the present date |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [date-fns.org/v2.14.0/docs/isValid](https://date-fns.org/v2.14.0/docs/isValid) |
||||
- [date-fns.org/v2.14.0/docs/isAfter](https://date-fns.org/v2.14.0/docs/isAfter) |
||||
- [date-fns.org/v2.14.0/docs/isBefore](https://date-fns.org/v2.14.0/docs/isBefore) |
||||
- [date-fns.org/v2.14.0/docs/isFuture](https://date-fns.org/v2.14.0/docs/isFuture) |
||||
- [date-fns.org/v2.14.0/docs/isPast](https://date-fns.org/v2.14.0/docs/isPast) |
||||
|
@ -1,12 +1,12 @@
|
||||
## Debounce |
||||
|
||||
### Instructions |
||||
|
||||
Create two functions that will work like `_.debounce` from lodash |
||||
- `debounce`, this function doesn't need to take care of the options |
||||
- `opDebounce`, this function will take care of the `leading` options |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://lodash.com/docs/4.17.15#debounce](https://lodash.com/docs/4.17.15#debounce) |
||||
## Debounce |
||||
|
||||
### Instructions |
||||
|
||||
Create two functions that will work like `_.debounce` from lodash |
||||
- `debounce`, this function doesn't need to take care of the options |
||||
- `opDebounce`, this function will take care of the `leading` options |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [lodash.com/docs/4.17.15#debounce](https://lodash.com/docs/4.17.15#debounce) |
||||
|
@ -1,9 +1,9 @@
|
||||
## Deep Copy |
||||
|
||||
### Instructions |
||||
|
||||
Create a function called `deepCopy` that copy objects and arrays recursively. |
||||
|
||||
### Notions |
||||
|
||||
- [https://devdocs.io/javascript-object/](https://devdocs.io/javascript-object/) |
||||
## Deep Copy |
||||
|
||||
### Instructions |
||||
|
||||
Create a function called `deepCopy` that copy objects and arrays recursively. |
||||
|
||||
### Notions |
||||
|
||||
- [devdocs.io/javascript-object](https://devdocs.io/javascript-object/) |
||||
|
@ -1,28 +1,28 @@
|
||||
## Filter |
||||
|
||||
### Instructions |
||||
|
||||
- Create a `filter` function that takes an array as first argument, a function as second, |
||||
and that works like the method [].filter |
||||
|
||||
- Create a `reject` function that takes an array as first argument, a function as second, |
||||
and that works like the reject function from lodash. |
||||
|
||||
- Create a `partition` function that takes an array as first argument, a function as second, |
||||
and that works like the partition function from lodash. |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://devdocs.io/javascript/global_objects/array/filter](https://devdocs.io/javascript/global_objects/array/filter) |
||||
- [https://lodash.com/docs/4.17.15#reject](https://lodash.com/docs/4.17.15#reject) |
||||
- [https://lodash.com/docs/4.17.15#partition](https://lodash.com/docs/4.17.15#partition) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
Array.prototype.filter = undefined |
||||
``` |
||||
## Filter |
||||
|
||||
### Instructions |
||||
|
||||
- Create a `filter` function that takes an array as first argument, a function as second, |
||||
and that works like the method [].filter |
||||
|
||||
- Create a `reject` function that takes an array as first argument, a function as second, |
||||
and that works like the reject function from lodash. |
||||
|
||||
- Create a `partition` function that takes an array as first argument, a function as second, |
||||
and that works like the partition function from lodash. |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [devdocs.io/javascript/global_objects/array/filter](https://devdocs.io/javascript/global_objects/array/filter) |
||||
- [lodash.com/docs/4.17.15#reject](https://lodash.com/docs/4.17.15#reject) |
||||
- [lodash.com/docs/4.17.15#partition](https://lodash.com/docs/4.17.15#partition) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
Array.prototype.filter = undefined |
||||
``` |
||||
|
@ -1,30 +1,30 @@
|
||||
## Find Expression |
||||
|
||||
### Instructions |
||||
|
||||
Create a function called `findExpression` that takes a number as parameter and returns a string |
||||
|
||||
- It will be given two constant variable `add4` and `mul2` |
||||
|
||||
- Your goal is to try to find a sequence, starting from the number 1, and repeatedly either adding 4 or multiplying 2 |
||||
that produces the number given has parameter. |
||||
For example, the number 8 you must first multiplying by 2 twice and then add 4. |
||||
It will look something like this `1 *2 *2 +4` |
||||
|
||||
- If the number can not be reached you should return `undefined` |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://nan-academy.github.io/js-training/examples/loops.js](https://nan-academy.github.io/js-training/examples/loops.js) |
||||
- [https://nan-academy.github.io/js-training/examples/recursion.js](https://nan-academy.github.io/js-training/examples/recursion.js) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
const add4 = '+4' |
||||
const mul2 = '*2' |
||||
``` |
||||
## Find Expression |
||||
|
||||
### Instructions |
||||
|
||||
Create a function called `findExpression` that takes a number as parameter and returns a string |
||||
|
||||
- It will be given two constant variable `add4` and `mul2` |
||||
|
||||
- Your goal is to try to find a sequence, starting from the number 1, and repeatedly either adding 4 or multiplying 2 |
||||
that produces the number given has parameter. |
||||
For example, the number 8 you must first multiplying by 2 twice and then add 4. |
||||
It will look something like this `1 *2 *2 +4` |
||||
|
||||
- If the number can not be reached you should return `undefined` |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/loops.js](https://nan-academy.github.io/js-training/examples/loops.js) |
||||
- [nan-academy.github.io/js-training/examples/recursion.js](https://nan-academy.github.io/js-training/examples/recursion.js) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
const add4 = '+4' |
||||
const mul2 = '*2' |
||||
``` |
||||
|
@ -1,19 +1,19 @@
|
||||
## Flat |
||||
|
||||
### Instructions |
||||
|
||||
Create the `flat` functions that works like the `.flat` array method |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://devdocs.io/javascript/global_objects/array/flat](https://devdocs.io/javascript/global_objects/array/flat) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
Array.prototype.flat = undefined |
||||
``` |
||||
## Flat |
||||
|
||||
### Instructions |
||||
|
||||
Create the `flat` functions that works like the `.flat` array method |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [devdocs.io/javascript/global_objects/array/flat](https://devdocs.io/javascript/global_objects/array/flat) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
Array.prototype.flat = undefined |
||||
``` |
||||
|
@ -1,28 +1,24 @@
|
||||
## Flow |
||||
|
||||
### Instructions |
||||
|
||||
Create the function `flow` that will works as the _.flow([funcs]) |
||||
from lodash. |
||||
|
||||
Example |
||||
|
||||
``` js |
||||
|
||||
const square = nbr => nbr * nbr |
||||
const add2Numbers = (nbr1, nbr2) => nbr1 + nbr2 |
||||
|
||||
const flowedFunctions = flow([add2numbers, square]) |
||||
flowedFunctions(2, 3) |
||||
|
||||
``` |
||||
|
||||
returns |
||||
|
||||
```js |
||||
25 |
||||
``` |
||||
|
||||
### Notions |
||||
|
||||
- [https://lodash.com/docs/4.17.15#flow](https://lodash.com/docs/4.17.15#flow) |
||||
## Flow |
||||
|
||||
### Instructions |
||||
|
||||
Create the function `flow` that will works as the \_.flow([funcs]) |
||||
from lodash. |
||||
|
||||
|
||||
### Example |
||||
|
||||
``` js |
||||
|
||||
const square = nbr => nbr * nbr |
||||
const add2Numbers = (nbr1, nbr2) => nbr1 + nbr2 |
||||
|
||||
const flowedFunctions = flow([add2numbers, square]) |
||||
flowedFunctions(2, 3) // -> 25 |
||||
|
||||
``` |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [lodash.com/docs/4.17.15#flow](https://lodash.com/docs/4.17.15#flow) |
||||
|
@ -1,20 +1,20 @@
|
||||
## For Each |
||||
|
||||
### Instructions |
||||
|
||||
Create a `forEach` function that takes an array as first argument, a function as second, |
||||
and that works like the method .forEach |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://devdocs.io/javascript/global_objects/array/foreach](https://devdocs.io/javascript/global_objects/array/foreach) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
Array.prototype.forEach = undefined |
||||
``` |
||||
## For Each |
||||
|
||||
### Instructions |
||||
|
||||
Create a `forEach` function that takes an array as first argument, a function as second, |
||||
and that works like the method .forEach |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [devdocs.io/javascript/global_objects/array/foreach](https://devdocs.io/javascript/global_objects/array/foreach) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
Array.prototype.forEach = undefined |
||||
``` |
||||
|
@ -1,28 +1,28 @@
|
||||
## Get Json |
||||
|
||||
### Instructions |
||||
|
||||
In this exercise, we will focus on building complex async flows with promises. |
||||
|
||||
Create a `getJSON` function that takes 2 parameters: |
||||
- `path`, that will be the url called by your function |
||||
- `params` *optional*, that will be the search parameters appended to your url |
||||
|
||||
`getJSON` must construct a valid url with the `path` and stringified `params` |
||||
and call `fetch` with it. |
||||
If the response is not ok, your function must throw an error using |
||||
the response status message. |
||||
|
||||
The response body must then be read and parsed from json. |
||||
|
||||
The parsed object contains one of those 2 properties: |
||||
- `"data"` the actual data to return |
||||
- `"error"` the error message to throw |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://nan-academy.github.io/js-training/examples/promise.js](https://nan-academy.github.io/js-training/examples/promise.js) |
||||
- [https://devdocs.io/dom/fetch_api/using_fetch](https://devdocs.io/dom/fetch_api/using_fetch) |
||||
- [https://devdocs.io/dom/urlsearchparams](https://devdocs.io/dom/urlsearchparams) |
||||
- [https://devdocs.io/javascript/global_objects/json](https://devdocs.io/javascript/global_objects/json) |
||||
## Get Json |
||||
|
||||
### Instructions |
||||
|
||||
In this exercise, we will focus on building complex async flows with promises. |
||||
|
||||
Create a `getJSON` function that takes 2 parameters: |
||||
- `path`, that will be the url called by your function |
||||
- `params` *optional*, that will be the search parameters appended to your url |
||||
|
||||
`getJSON` must construct a valid url with the `path` and stringified `params` |
||||
and call `fetch` with it. |
||||
If the response is not ok, your function must throw an error using |
||||
the response status message. |
||||
|
||||
The response body must then be read and parsed from json. |
||||
|
||||
The parsed object contains one of those 2 properties: |
||||
- `"data"` the actual data to return |
||||
- `"error"` the error message to throw |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/promise.js](https://nan-academy.github.io/js-training/examples/promise.js) |
||||
- [devdocs.io/dom/fetch_api/using_fetch](https://devdocs.io/dom/fetch_api/using_fetch) |
||||
- [devdocs.io/dom/urlsearchparams](https://devdocs.io/dom/urlsearchparams) |
||||
- [devdocs.io/javascript/global_objects/json](https://devdocs.io/javascript/global_objects/json) |
||||
|
@ -1,45 +1,45 @@
|
||||
## Gougle Search |
||||
|
||||
### Instructions |
||||
|
||||
Create the `queryServers` function, that takes 2 arguments: |
||||
- `serverName` a string of the name of the server |
||||
- `q` a string of the query given by the user |
||||
|
||||
You have to construct 2 urls, using `q` as a search parameter, |
||||
prepending a `'/'` and for the 2nd appending `'_backup'`. |
||||
|
||||
Then return the first value of those 2 calls |
||||
|
||||
```js |
||||
queryServers('pouet', 'hello+world') |
||||
// return the fastest of those 2 calls: |
||||
// -> getJSON('/pouet?q=hello+world') |
||||
// -> getJSON('/pouet_backup?q=hello+world') |
||||
``` |
||||
|
||||
|
||||
Create a `gougleSearch` function that takes a single query argument. |
||||
It must call `queryServers` in concurrently on 3 servers: |
||||
`'web'`, `'image'` and `'video'`. |
||||
|
||||
A timeout of 80milliseconds must be set for the whole operation. |
||||
|
||||
You must return the value from each servers in an object |
||||
using a the server name as key. |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://devdocs.io/javascript/global_objects/promise/race](https://devdocs.io/javascript/global_objects/promise/race) |
||||
- [https://devdocs.io/javascript/global_objects/promise/all](https://devdocs.io/javascript/global_objects/promise/all) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
// fake `getJSON` function |
||||
let getJSON = async (url) => url |
||||
``` |
||||
## Gougle Search |
||||
|
||||
### Instructions |
||||
|
||||
Create the `queryServers` function, that takes 2 arguments: |
||||
- `serverName` a string of the name of the server |
||||
- `q` a string of the query given by the user |
||||
|
||||
You have to construct 2 urls, using `q` as a search parameter, |
||||
prepending a `'/'` and for the 2nd appending `'_backup'`. |
||||
|
||||
Then return the first value of those 2 calls |
||||
|
||||
```js |
||||
queryServers('pouet', 'hello+world') |
||||
// return the fastest of those 2 calls: |
||||
// -> getJSON('/pouet?q=hello+world') |
||||
// -> getJSON('/pouet_backup?q=hello+world') |
||||
``` |
||||
|
||||
|
||||
Create a `gougleSearch` function that takes a single query argument. |
||||
It must call `queryServers` in concurrently on 3 servers: |
||||
`'web'`, `'image'` and `'video'`. |
||||
|
||||
A timeout of 80milliseconds must be set for the whole operation. |
||||
|
||||
You must return the value from each servers in an object |
||||
using a the server name as key. |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [devdocs.io/javascript/global_objects/promise/race](https://devdocs.io/javascript/global_objects/promise/race) |
||||
- [devdocs.io/javascript/global_objects/promise/all](https://devdocs.io/javascript/global_objects/promise/all) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
// fake `getJSON` function |
||||
let getJSON = async (url) => url |
||||
``` |
||||
|
@ -1,16 +1,16 @@
|
||||
## Greedy Url |
||||
|
||||
### Instructions |
||||
|
||||
Write 3 functions : |
||||
|
||||
- `getURL` that returns an array with all valid URLs present in a data-set, http and https |
||||
- `greedyQuery` that returns URL with at least 3 or more parameters from all URLs that contain a query. |
||||
- `notSoGreedy` that returns URL with at least 2, but not more then 3 parameters from all URLs that contain a query. |
||||
|
||||
You can search for greedy quantifiers for help |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://github.com/ziishaned/learn-regex](https://github.com/ziishaned/learn-regex) |
||||
## Greedy Url |
||||
|
||||
### Instructions |
||||
|
||||
Write 3 functions : |
||||
|
||||
- `getURL` that returns an array with all valid URLs present in a data-set, http and https |
||||
- `greedyQuery` that returns URL with at least 3 or more parameters from all URLs that contain a query. |
||||
- `notSoGreedy` that returns URL with at least 2, but not more then 3 parameters from all URLs that contain a query. |
||||
|
||||
You can search for greedy quantifiers for help |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [github.com/ziishaned/learn-regex](https://github.com/ziishaned/learn-regex) |
||||
|
@ -1,32 +1,32 @@
|
||||
## Index Of |
||||
|
||||
### Instructions |
||||
|
||||
Create 3 functions: |
||||
- `indexOf` that returns the index of the first occurence of a value |
||||
- `lastIndexOf` that returns the index of the last occurence of a value |
||||
- `includes` that returns true if the value was found in the array |
||||
|
||||
> If a value is not found, the returned index is -1 |
||||
|
||||
> functions should have an array element as first argument, |
||||
> both `indexOf` and `lastIndexOf` take an additional `fromIndex` argument |
||||
> that allows you to begin searching from a specific index. |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://devdocs.io/javascript/global_objects/array/indexof](https://devdocs.io/javascript/global_objects/array/indexof) |
||||
- [https://devdocs.io/javascript/global_objects/array/lastindexof](https://devdocs.io/javascript/global_objects/array/lastindexof) |
||||
- [https://devdocs.io/javascript/global_objects/array/includes](https://devdocs.io/javascript/global_objects/array/includes) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
Array.prototype.indexOf = undefined |
||||
Array.prototype.lastIndexOf = undefined |
||||
Array.prototype.includes = undefined |
||||
``` |
||||
## Index Of |
||||
|
||||
### Instructions |
||||
|
||||
Create 3 functions: |
||||
- `indexOf` that returns the index of the first occurence of a value |
||||
- `lastIndexOf` that returns the index of the last occurence of a value |
||||
- `includes` that returns true if the value was found in the array |
||||
|
||||
> If a value is not found, the returned index is -1 |
||||
|
||||
> functions should have an array element as first argument, |
||||
> both `indexOf` and `lastIndexOf` take an additional `fromIndex` argument |
||||
> that allows you to begin searching from a specific index. |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [devdocs.io/javascript/global_objects/array/indexof](https://devdocs.io/javascript/global_objects/array/indexof) |
||||
- [devdocs.io/javascript/global_objects/array/lastindexof](https://devdocs.io/javascript/global_objects/array/lastindexof) |
||||
- [devdocs.io/javascript/global_objects/array/includes](https://devdocs.io/javascript/global_objects/array/includes) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
Array.prototype.indexOf = undefined |
||||
Array.prototype.lastIndexOf = undefined |
||||
Array.prototype.includes = undefined |
||||
``` |
||||
|
@ -1,45 +1,45 @@
|
||||
## Interpolation |
||||
|
||||
### Instructions |
||||
|
||||
Create a function called `interpolation` that takes an object with 5 properties |
||||
`step`, `start`, `end`, `callback` and `duration`. |
||||
This function must calculate the interpolation points, (x, y), |
||||
from the `start` position to `end` position depending on the number of `steps`. |
||||
All the points must be calculated in the duration time. |
||||
|
||||
For each interpolation point you must execute and pass as parameters to the callback the interpolation point ([x, y]) |
||||
|
||||
|
||||
### Example |
||||
|
||||
``` |
||||
steps = 5 |
||||
start = 0 |
||||
end = 1 |
||||
duration = 10 |
||||
|
||||
t |
||||
| |
||||
10 |___________________. <- execute callback([1.0, 10]) |
||||
| | |
||||
| | |
||||
8 |_______________. | |
||||
| | | |
||||
| | | |
||||
6 |___________. | | |
||||
| | | | |
||||
| | | | |
||||
4 |_______. | | | |
||||
| | | | | |
||||
| | | | | |
||||
2 |___. | | | | |
||||
| | | | | | |
||||
|___|___|___|___|___|__d |
||||
0 0.2 0.4 0.6 0.8 1 |
||||
``` |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://javascript.info/settimeout-setinterval](https://javascript.info/settimeout-setinterval) |
||||
## Interpolation |
||||
|
||||
### Instructions |
||||
|
||||
Create a function called `interpolation` that takes an object with 5 properties |
||||
`step`, `start`, `end`, `callback` and `duration`. |
||||
This function must calculate the interpolation points, (x, y), |
||||
from the `start` position to `end` position depending on the number of `steps`. |
||||
All the points must be calculated in the duration time. |
||||
|
||||
For each interpolation point you must execute and pass as parameters to the callback the interpolation point ([x, y]) |
||||
|
||||
|
||||
### Example |
||||
|
||||
``` |
||||
steps = 5 |
||||
start = 0 |
||||
end = 1 |
||||
duration = 10 |
||||
|
||||
t |
||||
| |
||||
10 |___________________. <- execute callback([1.0, 10]) |
||||
| | |
||||
| | |
||||
8 |_______________. | |
||||
| | | |
||||
| | | |
||||
6 |___________. | | |
||||
| | | | |
||||
| | | | |
||||
4 |_______. | | | |
||||
| | | | | |
||||
| | | | | |
||||
2 |___. | | | | |
||||
| | | | | | |
||||
|___|___|___|___|___|__d |
||||
0 0.2 0.4 0.6 0.8 1 |
||||
``` |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [javascript.info/settimeout-setinterval](https://javascript.info/settimeout-setinterval) |
||||
|
@ -1,9 +1,9 @@
|
||||
## Invert |
||||
|
||||
### Instructions |
||||
|
||||
Create a function called `invert` that inverts the object keys and values. |
||||
|
||||
### Notions |
||||
|
||||
- [https://devdocs.io/javascript/global_objects/object](https://devdocs.io/javascript/global_objects/object) |
||||
## Invert |
||||
|
||||
### Instructions |
||||
|
||||
Create a function called `invert` that inverts the object keys and values. |
||||
|
||||
### Notions |
||||
|
||||
- [devdocs.io/javascript/global_objects/object](https://devdocs.io/javascript/global_objects/object) |
||||
|
@ -1,11 +1,11 @@
|
||||
## Ion Out |
||||
|
||||
### Instructions |
||||
|
||||
Make a function `ionOut` that receives a string and returns an array with every |
||||
word containing 'ion' following a t, without the 'ion'. |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://github.com/ziishaned/learn-regex#4-lookarounds](https://github.com/ziishaned/learn-regex#4-lookarounds) |
||||
## Ion Out |
||||
|
||||
### Instructions |
||||
|
||||
Make a function `ionOut` that receives a string and returns an array with every |
||||
word containing 'ion' following a t, without the 'ion'. |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [github.com/ziishaned/learn-regex#4-lookarounds](https://github.com/ziishaned/learn-regex#4-lookarounds) |
||||
|
@ -1,21 +1,21 @@
|
||||
## Its A Match |
||||
|
||||
### Instructions |
||||
|
||||
Create 4 regular expression in variables: |
||||
|
||||
- `normal` matches with the expression 'hi'. |
||||
|
||||
- `begin` matches with the expression 'hi', |
||||
only when it is in the beginning. |
||||
|
||||
- `end` matches with the expression 'hi', |
||||
only when it is in the end. |
||||
|
||||
- `beginEnd` matches with the expression 'hi', |
||||
only when it is in the beginning and the end. |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://github.com/ziishaned/learn-regex#28-anchors](https://github.com/ziishaned/learn-regex#28-anchors) |
||||
## Its A Match |
||||
|
||||
### Instructions |
||||
|
||||
Create 4 regular expression in variables: |
||||
|
||||
- `normal` matches with the expression 'hi'. |
||||
|
||||
- `begin` matches with the expression 'hi', |
||||
only when it is in the beginning. |
||||
|
||||
- `end` matches with the expression 'hi', |
||||
only when it is in the end. |
||||
|
||||
- `beginEnd` matches with the expression 'hi', |
||||
only when it is in the beginning and the end. |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [github.com/ziishaned/learn-regex#28-anchors](https://github.com/ziishaned/learn-regex#28-anchors) |
||||
|
@ -1,26 +1,26 @@
|
||||
## Keep Cut |
||||
|
||||
### Instructions |
||||
|
||||
Create the `cutFirst` function that takes a string |
||||
and remove the 2 first characters. |
||||
|
||||
Create the `cutLast` function that takes a string |
||||
and remove the 2 last characters. |
||||
|
||||
Create the `cutFirstLast` function that takes a string as parameter |
||||
and remove the 2 first characters and 2 last characters. |
||||
|
||||
Create a `keepFirst` function that takes a string as parameter |
||||
and return the string only keeping the 2 first characters. |
||||
|
||||
Create a `keepLast` function that takes a string as parameter |
||||
and return the string only keeping the 2 last characters. |
||||
|
||||
Create a `keepFirstLast` function that takes a string as parameter |
||||
and only keep 2 first characters and 2 last characters. |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://devdocs.io/javascript/global_objects/array/slice](https://devdocs.io/javascript/global_objects/array/slice) |
||||
## Keep Cut |
||||
|
||||
### Instructions |
||||
|
||||
Create the `cutFirst` function that takes a string |
||||
and remove the 2 first characters. |
||||
|
||||
Create the `cutLast` function that takes a string |
||||
and remove the 2 last characters. |
||||
|
||||
Create the `cutFirstLast` function that takes a string as parameter |
||||
and remove the 2 first characters and 2 last characters. |
||||
|
||||
Create a `keepFirst` function that takes a string as parameter |
||||
and return the string only keeping the 2 first characters. |
||||
|
||||
Create a `keepLast` function that takes a string as parameter |
||||
and return the string only keeping the 2 last characters. |
||||
|
||||
Create a `keepFirstLast` function that takes a string as parameter |
||||
and only keep 2 first characters and 2 last characters. |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [devdocs.io/javascript/global_objects/array/slice](https://devdocs.io/javascript/global_objects/array/slice) |
||||
|
@ -1,32 +1,32 @@
|
||||
## Match Cron |
||||
|
||||
### Instructions |
||||
|
||||
Create a function called `matchCron` it takes a valid cron schedule string |
||||
and a valid date. \ |
||||
It returns true if the date match the pattern |
||||
|
||||
> You only have to implement numbers and `*`. \ |
||||
> other complex patterns are not required. |
||||
|
||||
Only valid pattern will be tested. |
||||
|
||||
### Example |
||||
|
||||
```js |
||||
matchCron('9 * * * *', new Date('2020-05-30 18:09:00')) // -> true |
||||
matchCron('9 * * * *', new Date('2020-05-30 19:09:00')) // -> true |
||||
matchCron('9 * * * *', new Date('2020-05-30 19:21:00')) // -> false |
||||
// | | | | | |
||||
// | | | | +- Day of the Week (range: 1-7, 1 standing for Monday) |
||||
// | | | +--- Month of the Year (range: 1-12) |
||||
// | | +----- Day of the Month (range: 1-31) |
||||
// | +------- Hour (range: 0-23) |
||||
// +--------- Minute (range: 0-59) |
||||
``` |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [crontab.guru/](https://crontab.guru/) |
||||
- [devdocs.io/javascript/global_objects/date](https://devdocs.io/javascript/global_objects/date) |
||||
## Match Cron |
||||
|
||||
### Instructions |
||||
|
||||
Create a function called `matchCron` it takes a valid cron schedule string |
||||
and a valid date. \ |
||||
It returns true if the date match the pattern |
||||
|
||||
> You only have to implement numbers and `*`. \ |
||||
> other complex patterns are not required. |
||||
|
||||
Only valid pattern will be tested. |
||||
|
||||
### Example |
||||
|
||||
```js |
||||
matchCron('9 * * * *', new Date('2020-05-30 18:09:00')) // -> true |
||||
matchCron('9 * * * *', new Date('2020-05-30 19:09:00')) // -> true |
||||
matchCron('9 * * * *', new Date('2020-05-30 19:21:00')) // -> false |
||||
// | | | | | |
||||
// | | | | +- Day of the Week (range: 1-7, 1 standing for Monday) |
||||
// | | | +--- Month of the Year (range: 1-12) |
||||
// | | +----- Day of the Month (range: 1-31) |
||||
// | +------- Hour (range: 0-23) |
||||
// +--------- Minute (range: 0-59) |
||||
``` |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [crontab.guru](https://crontab.guru/) |
||||
- [devdocs.io/javascript/global_objects/date](https://devdocs.io/javascript/global_objects/date) |
||||
|
@ -1,15 +1,15 @@
|
||||
## More Or Less |
||||
|
||||
### Instructions |
||||
|
||||
Create 4 functions |
||||
- `more` that takes 1 argument and add 1 to it |
||||
- `less` that takes 1 argument and substract 1 to it |
||||
- `add` that takes 2 arguments and add them |
||||
- `sub` that takes 2 arguments and substract 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) |
||||
## More Or Less |
||||
|
||||
### Instructions |
||||
|
||||
Create 4 functions |
||||
- `more` that takes 1 argument and add 1 to it |
||||
- `less` that takes 1 argument and substract 1 to it |
||||
- `add` that takes 2 arguments and add them |
||||
- `sub` that takes 2 arguments and substract them |
||||
|
||||
|
||||
### 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) |
||||
|
@ -1,15 +1,15 @@
|
||||
## Nasa |
||||
|
||||
### Instructions |
||||
|
||||
Create a `nasa` function that takes a number `N` as a parameter and returns |
||||
a string with all numbers from 1 to the `N` separated by whitespace, with three exceptions: |
||||
- For numbers divisible by 3, add 'NA'. |
||||
- For numbers divisible by 5, add 'SA'. |
||||
- For the number that are divisible by 3 and 5 add 'NASA'. |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/loops.js](https://nan-academy.github.io/js-training/examples/loops.js) |
||||
- [nan-academy.github.io/js-training/examples/recursion.js](https://nan-academy.github.io/js-training/examples/recursion.js) |
||||
## Nasa |
||||
|
||||
### Instructions |
||||
|
||||
Create a `nasa` function that takes a number `N` as a parameter and returns |
||||
a string with all numbers from 1 to the `N` separated by whitespace, with three exceptions: |
||||
- For numbers divisible by 3, add 'NA'. |
||||
- For numbers divisible by 5, add 'SA'. |
||||
- For the number that are divisible by 3 and 5 add 'NASA'. |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/loops](https://nan-academy.github.io/js-training/examples/loops.js) |
||||
- [nan-academy.github.io/js-training/examples/recursion](https://nan-academy.github.io/js-training/examples/recursion.js) |
||||
|
@ -1,15 +1,15 @@
|
||||
## Primitives |
||||
|
||||
### Instructions |
||||
|
||||
Create a constant variable for each primitives: |
||||
- `str` for `String` |
||||
- `num` for `Number` |
||||
- `bool` for `Boolean` |
||||
- `undef` for `undefined` |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/primitive-and-operators.js](https://nan-academy.github.io/js-training/examples/primitive-and-operators.js) |
||||
- [nan-academy.github.io/js-training/examples/variables.js](https://nan-academy.github.io/js-training/examples/variables.js) |
||||
## Primitives |
||||
|
||||
### Instructions |
||||
|
||||
Create a constant variable for each primitives: |
||||
- `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) |
||||
|
@ -1,27 +1,27 @@
|
||||
## Pyramid |
||||
|
||||
### Instructions |
||||
|
||||
Create a `pyramid` function that takes a string and a number as parameters |
||||
and return a pyramid constructed by the string passed as argument and with the depth |
||||
of the number passed as argument. |
||||
|
||||
Just like triangle |
||||
|
||||
### Output example |
||||
|
||||
- `*` character and depth of 5 : |
||||
|
||||
``` |
||||
* |
||||
*** |
||||
***** |
||||
******* |
||||
********* |
||||
``` |
||||
> No new line in last line |
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/loops.js](https://nan-academy.github.io/js-training/examples/loops.js) |
||||
- [nan-academy.github.io/js-training/examples/recursion.js](https://nan-academy.github.io/js-training/examples/recursion.js) |
||||
## Pyramid |
||||
|
||||
### Instructions |
||||
|
||||
Create a `pyramid` function that takes a string and a number as parameters |
||||
and return a pyramid constructed by the string passed as argument and with the depth |
||||
of the number passed as argument. |
||||
|
||||
Just like triangle |
||||
|
||||
### Output example |
||||
|
||||
- `*` character and depth of 5 : |
||||
|
||||
``` |
||||
* |
||||
*** |
||||
***** |
||||
******* |
||||
********* |
||||
``` |
||||
> No new line in last line |
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/loops](https://nan-academy.github.io/js-training/examples/loops.js) |
||||
- [nan-academy.github.io/js-training/examples/recursion](https://nan-academy.github.io/js-training/examples/recursion.js) |
||||
|
@ -1,24 +1,24 @@
|
||||
## Race |
||||
|
||||
### Instructions |
||||
|
||||
Create a function `race` that works like `Promise.race` |
||||
|
||||
Create a function `some` that takes an array of promises or values |
||||
and a number and return the first resolved values up to the number given. |
||||
> Empty array or a count of 0 return a promise resolving to `undefined` |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/promise.js](https://nan-academy.github.io/js-training/examples/promise.js) |
||||
- [devdocs.io/javascript/global_objects/promise/race](https://devdocs.io/javascript/global_objects/promise/race) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
Promise.race = undefined |
||||
``` |
||||
## Race |
||||
|
||||
### Instructions |
||||
|
||||
Create a function `race` that works like `Promise.race` |
||||
|
||||
Create a function `some` that takes an array of promises or values |
||||
and a number and return the first resolved values up to the number given. |
||||
> Empty array or a count of 0 return a promise resolving to `undefined` |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/promise](https://nan-academy.github.io/js-training/examples/promise.js) |
||||
- [devdocs.io/javascript/global_objects/promise/race](https://devdocs.io/javascript/global_objects/promise/race) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
Promise.race = undefined |
||||
``` |
||||
|
@ -1,24 +1,24 @@
|
||||
## Repeat |
||||
|
||||
### Instructions |
||||
|
||||
Create a `repeat` function that takes a string and a number as parameters |
||||
and return the repeated string by the given number |
||||
Like the method [developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat) |
||||
Of course you may not use the method directly |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/loops.js](https://nan-academy.github.io/js-training/examples/loops.js) |
||||
- [nan-academy.github.io/js-training/examples/recursion.js](https://nan-academy.github.io/js-training/examples/recursion.js) |
||||
- [devdocs.io/javascript/global_objects/string/repeat](https://devdocs.io/javascript/global_objects/string/repeat) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
String.prototype.repeat = undefined |
||||
``` |
||||
## Repeat |
||||
|
||||
### Instructions |
||||
|
||||
Create a `repeat` function that takes a string and a number as parameters |
||||
and return the repeated string by the given number |
||||
Like the method [developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat) |
||||
Of course you may not use the method directly |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/loops](https://nan-academy.github.io/js-training/examples/loops.js) |
||||
- [nan-academy.github.io/js-training/examples/recursion](https://nan-academy.github.io/js-training/examples/recursion.js) |
||||
- [devdocs.io/javascript/global_objects/string/repeat](https://devdocs.io/javascript/global_objects/string/repeat) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
String.prototype.repeat = undefined |
||||
``` |
||||
|
@ -1,12 +1,12 @@
|
||||
## Replica |
||||
|
||||
### Instructions |
||||
|
||||
Create a function called `replica` that allows you to deep assign the values of all properties from one or more |
||||
objects to a target object. |
||||
|
||||
Attention with the shallow copies. |
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/data-structures.js](https://nan-academy.github.io/js-training/examples/data-structures.js) |
||||
## Replica |
||||
|
||||
### Instructions |
||||
|
||||
Create a function called `replica` that allows you to deep assign the values of all properties from one or more |
||||
objects to a target object. |
||||
|
||||
Attention with the shallow copies. |
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/data-structures](https://nan-academy.github.io/js-training/examples/data-structures.js) |
||||
|
@ -1,15 +1,15 @@
|
||||
## Returns |
||||
|
||||
### Instructions |
||||
|
||||
Create the following functions: |
||||
|
||||
- `id` that takes one argument and return it |
||||
- `getLength` that takes an array or a string and return its length |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [https://nan-academy.github.io/js-training/examples/functions.js](https://nan-academy.github.io/js-training/examples/functions.js) |
||||
- [https://nan-academy.github.io/js-training/examples/data-structures.js](https://nan-academy.github.io/js-training/examples/data-structures.js) |
||||
- [https://nan-academy.github.io/js-training/examples/get.js](https://nan-academy.github.io/js-training/examples/get.js) |
||||
## Returns |
||||
|
||||
### Instructions |
||||
|
||||
Create the following functions: |
||||
|
||||
- `id` that takes one argument and return it |
||||
- `getLength` that takes an array or a string and return 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) |
||||
|
@ -1,11 +1,11 @@
|
||||
## Series |
||||
|
||||
### Instructions |
||||
|
||||
Create a function `series` that works takes an array of async functions. |
||||
It must execute them in series and return the results in order. |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/promise.js](https://nan-academy.github.io/js-training/examples/promise.js) |
||||
## Series |
||||
|
||||
### Instructions |
||||
|
||||
Create a function `series` that works takes an array of async functions. |
||||
It must execute them in series and return the results in order. |
||||
|
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/promise](https://nan-academy.github.io/js-training/examples/promise.js) |
||||
|
@ -1,27 +1,27 @@
|
||||
## Sign |
||||
|
||||
### 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 the `sameSign` function that takes 2 numbers as arguments and return true |
||||
if they both have the same sign, or false otherwise. |
||||
|
||||
|
||||
### 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/if-else.js](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) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
Math.sign = undefined |
||||
``` |
||||
## Sign |
||||
|
||||
### 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 the `sameSign` function that takes 2 numbers as arguments and return 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) |
||||
|
||||
|
||||
### Code provided |
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited. |
||||
|
||||
```js |
||||
Math.sign = undefined |
||||
``` |
||||
|
@ -1,25 +1,25 @@
|
||||
## Triangle |
||||
|
||||
### Instructions |
||||
|
||||
Create a `triangle` function that takes a string and a number as parameters |
||||
and return a triangle constructed by the string passed as argument and with the depth |
||||
of the number passed as argument. |
||||
|
||||
### Output example |
||||
|
||||
- `*` character and depth of 5: |
||||
|
||||
``` |
||||
* |
||||
** |
||||
*** |
||||
**** |
||||
***** |
||||
``` |
||||
> No new line in last line |
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/loops.js](https://nan-academy.github.io/js-training/examples/loops.js) |
||||
- [nan-academy.github.io/js-training/examples/recursion.js](https://nan-academy.github.io/js-training/examples/recursion.js) |
||||
## Triangle |
||||
|
||||
### Instructions |
||||
|
||||
Create a `triangle` function that takes a string and a number as parameters |
||||
and return a triangle constructed by the string passed as argument and with the depth |
||||
of the number passed as argument. |
||||
|
||||
### Output example |
||||
|
||||
- `*` character and depth of 5: |
||||
|
||||
``` |
||||
* |
||||
** |
||||
*** |
||||
**** |
||||
***** |
||||
``` |
||||
> No new line in last line |
||||
|
||||
### Notions |
||||
|
||||
- [nan-academy.github.io/js-training/examples/loops](https://nan-academy.github.io/js-training/examples/loops.js) |
||||
- [nan-academy.github.io/js-training/examples/recursion](https://nan-academy.github.io/js-training/examples/recursion.js) |
||||
|
Loading…
Reference in new issue