If given an object as a parameter to modify a created ExcelFile
(using Class), how can I go through that object to find what parameter needs to be modified and then changed in the ExcelFile
?
For example if I call modify({date: 12/31/2020})
I want it to update the date to 12/31/2020, however if I give it modify({date: '12/31/2020', duration: '60 minutes'})
it would update both date and duration.
My thinking was below but it is not identifying date...
class ExcelFile{
constructor(arr){
this.date = arr[0];
this.duration = arr[1];
}
modify(obj){
for (let key in obj) {
if (obj[key] === "date") {
this.date = obj[date];
}
}
}
}