replacing characters in string javascript
var myStr = 'this,is,a,test';
var newStr = myStr.replace(/,/g, '-');
console.log( newStr ); // "this-is-a-test"
replacing characters in string javascript
var myStr = 'this,is,a,test';
var newStr = myStr.replace(/,/g, '-');
console.log( newStr ); // "this-is-a-test"
replace element from string javascript
var string="hollo"
console.log(string.replace(/o/g,'P'))
//replace o with P
replace character inside a string in JavaScript
function strReplace(){
var myStr = 'quick_brown_fox';
var newStr = myStr.replace(/_/g, "-");
// Insert modified string in paragraph
document.getElementById("myText").innerHTML = newStr;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us