Computer Science, asked by nick358, 10 months ago

How to replace all dots in a string using JavaScript?

Answers

Answered by Anonymous
0

Use the JavaScript replace() method

<script type="text/javascript">

var myStr = 'freedom is not worth having if it does not include the freedom to make mistakes.';

var newStr = myStr. replace(/freedom/g, "liberty");

// Printing the modified string.

document. write(newStr);

</script>

I hope this will help you

If helpful then please select my answer as brainliest answer

And also follow me ❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️

Answered by Anonymous
0

\huge\red{Answer}

Use the JavaScript replace() method

1) <script type="text/javascript">

2) var myStr = 'freedom is not worth having if it does not include the freedom to make mistakes.';

3) var newStr = myStr. replace(/freedom/g, "liberty");

4) // Printing the modified string.

5) document. write(newStr);

6) </script>

HOPE IT HELPS YOU !!

Similar questions