Exercises to evaluate students about basic functional programming in JavaScript.
Please install dependencies first.
npm install
To launch the tests.
npm test
To lint sources.
npm run lint
To start program.
npm start
Implement the function sortProduct(input) in file src/exercise1.js where the input is an array of products with a property dateAdded in UNIX timestamp (milliseconds) format.
The function should filter product before year 2000, sort by date and group by product.
You don't understand what you need to do ?
Don't stress tests are written in file test/exercise1.test.js to explain the behaviour of the function.
To implement the function, you should do in a functional way WITHOUT using Lodash or any another FP library.
But you cloud use the moment library to manipulate dates.
All tests describe in file test/exercise1.test.js should pass with success, and it's forbidden to change this file.
After finish this exercise, please commit all your files.
git add .
git commit -m "Exercise 1"
The function yolo(input) in file src/exercise2.js has been implemented by an another developper and the test is present in test/exercise2.js, but he forgot to commit the input to pass the test ...
Could you guess the input "whereIsMyMind" please ? Becareful only this input should change.
The test should pass with success.
After finish this exercise, please commit all your files.
git add .
git commit -m "Exercise 2"
Implement the function meeteek(input) in file src/exercise3.js where the input is an array of people.
The function should return an object about network relationship.
You don't understand what you need to do ?
Don't stress tests are written in file test/exercise3.test.js to explain the behaviour of the function.
To implement the function, you should do in a functional way.
You cloud use the Lodash library to help you.
After finish this exercise, please commit all your files.
git add .
git commit -m "Exercise 3"
Implement the function countSequence(sequence, input) in file src/exercise4.js where sequence and input are strings, the output the number of sequence into the input.
You don't understand what you need to do ?
Don't stress tests are written in file test/exercise4.test.js and they should pass with success.
Be careful the function should be able to work in a CURRY WAY too.
- 👉
split()could help you.
After finish this exercise, please commit all your files.
git add .
git commit -m "Exercise 4"