Answers for "js string replaceall"

8

js string replaceall

// Chrome 85+
str.replaceAll(val, replace_val);
// Older browsers
str.replace(/val/g, replace_val);
Posted by: Guest on March-24-2021
14

javascript replaceall string

const p = 'The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?';

console.log(p.replaceAll('dog', 'monkey'));
// expected output: "The quick brown fox jumps over the lazy monkey. If the monkey reacted, was it really lazy?"
Posted by: Guest on June-19-2021
58

javascript replace string

var str = "JavaScript replace method test";
var res = str.replace("test", "success");  
//res = Javscript replace method success
Posted by: Guest on July-10-2020
26

replace all occurrences of a string in javascript

const p = 'The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?';

console.log(p.replaceAll('dog', 'monkey'));

// expected output: "The quick brown fox jumps over the lazy monkey. If the monkey reacted, was it really lazy?"
Posted by: Guest on July-25-2020
6

str replace javascript all

str.replace(/abc/g, '');
Posted by: Guest on May-16-2020
1

javascript replaceall

//as of August 2020, not supported on older browsers
str.replaceAll("abc","def")
Posted by: Guest on October-17-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language