Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Split Slice

Learn about JavaScript String.slice, String.split, and characters.

Before you Begin


Also be sure you have installed Mocha and chai:

npm install -g mocha
npm install

JavaScript Characters

To represent a character in JavaScript use a string with a single character in it: 'a', 'b', 'c'. There are also escape sequences:

Character Name
\b backspace
\t tab
\n newline - linefeed
\v vertical tab
\f form feed
\r carraige return
" double quote
' single quote
\\ back slash


The goal of this assignment is to get all the tests to pass and to be sure jshint returns zero errors. You must:

  • Use String.split in each method for Splits.js
  • Use String.slice in each method for Slices.js

As a general rule the answers in the body of a solution are a single line of code. You will also include use strict, so that is two lines. A few questions do require additional lines of code, but in general, the solutions are short.

Run the tests

To get started:

npm install

You can also start the tests this way:

npm test

Turn it in

Copy your version of the solution to your repository and place it in the root of a folder called Week02-SplitSlice. Check it in. When you submit the assignment be sure include the URL of your repository. It should look something like this: