GoConqr has a new look! Let us know what you think.

Module 8 of 9 · Media

Replace Strings

Kostas Diakogiannis

Replace Strings

Replace string method

The replace function, when attached to a string can replace a part of a string, with another specified string. 

The function is simple. Accepts two arguments. The first contains the string that we want to get rid off, and the second contains the string that is going to replace it.

Take a closer look to the example above, we replace the word 'negative' which lies inside the sentence string variable, with the word 'positive'. The replaced string is stored into a new string variable. 

In the end, line 5 prints: 'I have something positive to say here'

Instructions

You must submit an attempt for this quiz to progress. You can submit it after the last question.

Go to the chosen module

Feedback

What is it about?

What do you think of the new look?

How do you like it?