I am trying to come up with an optimized solution where I need to loop through 1000's of records in an excel sheet.
I have scenarios like:
if (!lei.renewalDate) {
lei.renewalDate = new Date(record.renewalDate).getTime();
}
if (lei.isManagedByGIDM === undefined || lei.isManagedByGIDM === null) {
lei.isManagedByGIDM = this.organiseManagedByData(record.managedByOthers);
}
My question is, does it make any sense in checking the existence of renewalDate or can I directly call
lei.renewalDate = new Date(record.renewalDate).getTime();?
I am adding an extra check to if I need to call a such small built-in function. I am doing the same in the second condition check, to determine if I need to call in organiseManagedByData method (which is a small function with no other function call in it).
I am trying to learn time and space complexity.
Is there a way I can determine the cost of the above code