Exercise: Turning a List of Phrases Into an Array of Strings

Challenge yourself and try writing a coding solution to the problem of turning a list of phrases into an array of strings.

We'll cover the following

This is a very basic search and replace use case for regular expressions. You might actually find yourself doing it often in your IDE of choice. However, the idea of this exercise is to write a JavaScript function that will perform these two actions all at once.

Remember that this is not about creating a JavaScript array that you can later use. For that, we could simply call the split method for our input string. This is about parsing a text file and writing the JavaScript code required to include this code into an array if you so want.

Output

Simply put, the output of our function will be code, not an actual array. In other words:

Get hands-on with 1400+ tech skills courses.