Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Stuck on a problem in javascript

I solved it thanks

1 Answer

A Laypanov
A Laypanov
27,579 Points

Sorry, this is my first post, can't get code to display right. As far as I know split() method is used to separate strings, but your case is different. You should create an empty variable, then iterate through your first string like it's an array, if an item from that loop matches your second string, substitute it with the third string. Don't forget to keep adding items to your new variable. After loop is done, log variable to the console. I will post the code, once I find out how to do it.