I am working with a string array:
values: string['myName', 'myLastname', 'myAge']
and my goal is to assign each value to a property of an object like this: myModel={name:'', lastname:'', age:''}
one by one.
I attempted to write the code as follows:
let i =0;
Object.keys(this.myModel).forEach((key) => {
this.myModel[key] = this.values[i];
i++;
});
Unfortunately, I encountered an error. Can you help me fix it?