const str = 'Thanks for contributing an answer to Stack Overflow!'
const substr = ['for', 'to']
function boldString(str, substr) {
let boldStr
boldStr = str
substr.map(e => {
const strRegExp = new RegExp(e, 'g');
boldStr= boldStr.replace(strRegExp, `<strong>${e}</strong>`);
}
)
return boldStr
}
boldString(str, substr)
const str = 'Thanks for contributing an answer to Stack Overflow!'
const substr = ['for', 'to']
function boldString(str, substr) {
let boldStr
boldStr = str
substr.map(e => {
const strRegExp = new RegExp(e, 'g');
boldStr= boldStr.replace(strRegExp, `<strong>${e}</strong>`);
}
)
return boldStr
}
boldString(str, substr)
const str = 'Thanks for contributing an answer to Stack Overflow!'
const substr = ['for', 'to']
function boldString(str, substr) {
let boldStr
boldStr = str
substr.map(e => {
const strRegExp = new RegExp(e, 'g');
boldStr= boldStr.replace(strRegExp, `<strong>${e}</strong>`);
}
)
return boldStr
}