First, fork this repository.
# download your code locally
git clone https://github.com/GITHUB_LOGIN/js-training.git
# change working directory to the newly cloned repository
cd js-training
Once you have coded your masterpiece, you can start to test your solutions.
You may either use our test tool to check all files
# run the test runner
./tester
Or you can test files one by one with node
# open a file in node
node exercises/primitive
our tester may include bugs, feel free to check the code and fix it
(in doubt use node)
You can start editing the javascript files with your favorite text editor.
# Sublime Text
subl primitive.js
# VSCode
code primitive.js
# Vim
vim primitive.js
# I can not be held responsable if you use anything else.
We maintain an example based code documentation
All you need to know to solve those exercises is described in them.
- Primitive and Operators [screencast]
- Variables [screencast]
- Data-Structures [screencast]
- Get [screencast]
- Set [screencast]
- ...full list
And we also made you a currated list of all the most usefull methods :
- Math min, max, abs, sign, round, floor, ceil, trunc, random*
- String
- Transform slice, split, replace, toUpperCase, toLowerCase, trim, trimRight, trimLeft, padStart, padEnd
- Search includes, startsWidth, endsWith, indexOf, lastIndexOf, charCodeAt
- Arrays Array.from, Array.isArray, fill*
(*) methods in italics are NOT pure (using them with the same arguments won't return the same result). They must be used with caution as it is harder to predict their results
We may update tests, to apply them fetch and merge the master branch back to your branch.
git merge pull push branch checkout origin master stash pop
We recommand to use editorconfig
to
auto-config your editor to match the coding style
We also made an .eslint
rule to help you formating your code.
You may want to use eslint
and prettier-eslint
for painless application of
the style
We greatly recommand you to add your own tests to this list
- add your test file (ex:
exercises/my-test.js
) - edit
package.json
and add"my-test"
to the"tests"
array - make a pull request !
https://github.com/nan-academy/js-training/compare/master...GITHUB_LOGIN:master
All the tests must be written using assert
for ./tester
to work properly.