replacing characters in string javascript
var str = "JavaScript replace method test";
var res = str.replace("test", "success");
//res = Javscript replace method successvar myStr = 'this,is,a,test';
var newStr = myStr.replace(/,/g, '-');
console.log( newStr ); // "this-is-a-test"let string = 'soandso, my name is soandso';
let replaced = string.replace(/soandso/gi, 'Dylan');
console.log(replaced); //Dylan, my name is Dylan
Also in JavaScript:
- js random minus
- mac os chrome opne debug new tab
- javascript submit a form with id
- js get base url
- how to check the extension of a file in javascript
- javascript date difference in months
- angular component lifecycle hooks
- mongodb gte
- how to make a var and sprite in javascript
- javascript update text in div
- checkbox is checked jquery
- react native setstate object
- js isset
- string to boolean javascript
- install node modules
- js escape url parameter
- .push js
- how to add google map in react js
- wait time js
- js yesterday date
- js jquery class ending with string
- json stringify pretty
- how to set background colour i js inline stylel
- javascript animate elements