Answers for "how to replace all from string in javascript"

14

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
1

create function replace all n javescript

const search = ' ';
const replaceWith = '-';
const result = 'duck duck go'.replaceAll(search, replaceWith);
result; // => 'duck-duck-go'
Posted by: Guest on November-12-2021

Code answers related to "how to replace all from string in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language