I have an object with tow properties and string, where I have the object name. I want to change object name with object value global, but not working.
let obj = {
name: 'year',
value: '2020',
};
let str = 'year year';
str.replace(/obj.name/g, obj.value);