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
Unsubscribed User
17,284 PointsMore help with JS
I'm trying to create a for loop and a while loop for the following variables. Instructions are in the comments. I can't figure out how to do this. I'm trying to get a for loop for sentence1 and a while loop for sentence2. Any help would be greatly appreciated.
var sentence1 = "More food please.",
sentence2 = "Come over here so you can scratch my belly.";
/*
Your goal is to replace all words in the above sentences with "chirp",
except replace food with "yum" and "scratch" with "purr".
Use **two** different kinds of loops to implement this.
HINT: the "split" method on String will be useful.
*/