+ 1
Replace specific string with another string
if text is contain '*' then replce that element '*' with this one '×' how to do that https://code.sololearn.com/W3QQfKvaA3XX/?ref=app
3 ответов
+ 5
Use replaceAll function
console.log(text.replaceAll("*", "+"))
+ 3
It's work thanks man A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟
+ 3
Use replace func
var str = "Sololearn is great";
var result = str.replace("great", "nice");
To replace all add /"str"/g
var str = "Sololearn is great";
var result = str.replace("/great/g", "nice");