Anonymous contributor1 total contribution
Published Oct 9, 2023
Contribute to Docs
.replaceAll() method returns a new string by replacing all the matches in a string of a given search value with a given replacement value.
Replace all the occurrences of
const sentence = `I scream, you scream, we all scream for ice cream.`;console.log(sentence.replaceAll('scream', 'laugh'));
This example results in the following output:
I laugh, you laugh, we all laugh for ice cream.
- Anonymous contributorAnonymous contributor1 total contribution
- Anonymous contributor
Front-End EngineerFront-end engineers work closely with designers to make websites beautiful, functional, and fast.
Includes 34 Courses
With Professional Certification
Beginner Friendly124 Lessons