Find And Replace It In A String Javascript

[Solved] Find And Replace It In A String Javascript | Vb - Code Explorer | yomemimo.com
Question : find and replace it in a string javascript

Answered by : grieving-gharial-54afdxs4rdwl

var name = "Pieter";
console.log(name.replace("Pi", "P"));

Source : https://careerkarma.com/blog/javascript-replace/ | Last Update : Thu, 04 Nov 21

Question : using of replace() in Javascript

Answered by : ashraf-tanvir

let str = "I like to eat, eat, eat apples and bananas";
let re = /apples|bananas/gi;
let newStr = str.replace(re, (match) => { console.log({match}); return match.toUpperCase();
});
console.log(newStr);
Code language: JavaScript (javascript)

Source : https://www.javascripttutorial.net/javascript-string-replace/ | Last Update : Wed, 26 Oct 22

Answers related to find and replace it in a string javascript

Code Explorer Popular Question For Vb