Credits: Clément Denis for the original repo.
First, fork this repository: you'll then have a copy of this repo under your GitHub account.
Then go to wherever you store your development work, and run these commands to clone the forked repo (replace GITHUB_LOGIN
with your login):
# download your code locally
git clone https://github.com/GITHUB_LOGIN/js-training-tdd.git
# change working directory to the newly cloned repository
cd js-training-tdd
Prerequisites: you must have installed Git!
Node.js is a platform which makes it possible to run JavaScript code outside the web browser.
You have to install Node.js, preferably not with the packages on Node's download page.
Note for Linux users: before going further, run which curl
in the terminal. If it shows something (e.g. /usr/bin/curl
), you're good! Otherwise, run sudo apt install -y curl
(Ubuntu/Debian) to install cURL.
You are going to use NVM (Node Version Manager). Here's a summary of what you have to do (see installation instructions on the NVM repo for more details). Run these commands in your terminal:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.bashrc
nvm install v12.16.1
nvm use v12.16.1
You can verify that it worked by running node -v
, which should display:
v12.16.1
The original NVM doesn't support Windows. You're going to use NVM for Windows. Get to the releases page. Under the latest version (1.1.7 as of September 2019), download the nvm-setup.zip
file (or use this direct link).
Extract the archive, and run nvm-setup.exe
. Complete the setup wizard. Then, quit Git Bash if it is running, re-launch it, and type:
nvm install v12.16.1
nvm use v12.16.1
Running node -v
should display: v12.16.1
.
Once you have coded your masterpiece, you can start testing your solutions.
You can run tests for a single section:
# run the test runner with args ( basics, advanced, math, get)
./tester basics
Later on, you may use tester
with no argument, to check exercises from all sections (in this example, basics
, math
and part of str
have been solved):
# run the test runner
./tester
You can start editing the JavaScript files with your favorite text editor i.e. VSCode, Atom, Sublime Text, etc.
We maintain an example-based code documentation
All you need to know to solve those exercises is described in them.
And we also made you a curated list of all the most useful 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, startsWith, endsWith, indexOf, lastIndexOf, charCodeAt
- Arrays Array.from, Array.isArray, fill*
- Object keys, values, entries, assign, fromEntries
(*) 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