Strings
Strings in JavaScript represent text. To create a string, you can put any characters you want between two quote-marks, like this:
This even includes characters like spaces, or even no characters at all - an empty string ''
.
Both single quotes and double quotes ("
) will work, but the preferred option is to use single quotes.
You can also create a special type of string called a template-literal by using backticks (`
):
There are only six functions to write for this part of the challenge. Lots of the cool stuff you can do to manipulate strings actually involves arrays, and we will cover that a bit later.
To run the tests for this challenge, run npm test -- strings
In the same manner as before, try to fix all of the failing tests - one at a time, starting with the one at the top of your stack trace:
- Run the tests
- Read the error message
- Write some code to fix that message
- Repeat
And again, commit to git regularly, and use the links provided and google to help you if you get stuck!
Then move on to the next challenge; booleans.