I have this object:
let user = {
name: undefined,
age: undefined,
city: undefined,
}
and these arrays
props = ["name", "age", "city"];
values = ["alan", 90, "london"];
and i want to do something like this
for (i=0; i<props.length; i++){
user.${prop[i]} = values[i];
}
But I can't figure out how to use template strings as I pretend
The idea is to generate a function that can fill given properties of an object with given values, avoiding writing a lot of function calls