Very simple little question, but I don\'t quite understand how to do it.
I need to replace every instance of \'_\' with a space, and every instance of \'#\' with no
String.prototype.replaceAll=function(obj,keydata='key'){
const keys=keydata.split('key');
return Object.entries(obj).reduce((a,[key,val])=> a.replace(new RegExp(`${keys[0]}${key}${keys[1]}`,'g'),val),this)
}
const data='hids dv sdc sd {yathin} {ok}'
console.log(data.replaceAll({yathin:12,ok:'hi'},'{key}'))
String.prototype.replaceAll=function(keydata,obj){
const keys=keydata.split('key');
return Object.entries(obj).reduce((a,[key,val])=> a.replace(${keys[0]}${key}${keys[1]}
,val),this)
}
const data='hids dv sdc sd ${yathin} ${ok}' console.log(data.replaceAll('${key}',{yathin:12,ok:'hi'}))