[Javascript] How do I remove a substring from a given string?
I want to remove a substring from a given string. How can I do that in Javascript?
1 Answer
3 years ago by Jahaan
Use replace()
method to remove a substring from a given string. For example, if you want to remove test
from the string This is a test message
let str = 'This is a test message';
console.log(str.replace('test',''));
3 years ago by Meera