const values = ['Banana','Yellow','Columbia'];
const keys = ['Fruit','Color','Producer'];
const obj = Object.fromEntries(keys.map((key, index) => [key, values[index]]));
const getRow = (obj) => {
return (strings, ...values) => {
return strings.reduce((result, string, index) => {
result += string + (obj[values[index]] || '');
return result;
}, '');
}
}
console.log(getRow(obj)`The <b>${"Fruit"}/b> you are eating is ${"Color"} and was produced in ${"Producer"}`);