Reputation: 190
const Str = 'Your name +++Vijay+++Welcome to hello world '
I want to replace Vijay with reactJS content editable, where i can change the name.
Upvotes: 0
Views: 108
Reputation: 2104
I think you can use the replace function https://www.w3schools.com/jsref/jsref_replace.asp
let Str = 'Your name +++Vijay+++Welcome to hello world '
Str = Str.replace("Vijay", "something you want")
Upvotes: 0
Reputation: 1143
you can use string template to do that try
const changeStr = (name = "USER_NAME") => `Your name ${name} Welcome to hello world`
then
changeStr('Vijay')
Upvotes: 1