Need Fix Function Basically Im Printing Phrase Like E X M P L E Printing Extra Space End L Q37088339

I need to fix this function.

Basically, im printing out a phrase like this: ” e x a m p le”

But its printing an extra space at the end like this: “e x a m pl e “

I need to get rid of the space at the end.

This is the note I have to fix it but I cant figure it out.

For phraseWithBlanks(), you need to change your for loop to havean index variable. That way you can only add a ” ” to the string ifyou are not at the end:

if (index + 1 < phrases.length())

{

    // adds a space

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.