The goal of this exercise is to practice some cool ES6 features by doing TDD. This kind of practice is known as koans.
To solve this kind of exercise you don't have to know unit testing, since you won't write any test and the output of the tests will be rendered in the terminal. However, it might be helpful for some people to look at the test itself to understand what has to be implemented in every case.
If you have yarn:
git clone [email protected]:leanjscom/es6-exercise.git && cd es6-exercise && yarn install
If you have npm:
git clone [email protected]:leanjscom/es6-exercise.git && cd es6-exercise && npm install
- run
npm test
oryarn test
, by default it will run all the tests. - We recommend you to start by running just one file, for instance:
npm run test -- src/01*
will run just this test 01_destructure.test.js.npm run test -- src/02*
will run just this test 02_rest-operator.test.js.- and so on
- You can fix them in any order, but we recommend you to start from test 01, then 02, and so on.
- Once all the tests pass, you'll be an ES6 expert! :)
- Understand the features of JavaScript ES6 that are essential to working with React
Here are links to the docs where the points covered are addressed:
-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let
-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const
-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters
-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters
-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax
-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce
You can also check out this list of more in depth articles on ES6: https://hacks.mozilla.org/category/es6-in-depth/