This is the way FileObject is built and I need help in figuring out how to iterate and find a value based on the date provided.
interface MyProps{ date: string; cDataFileName?: string | undefined; iDataFileName?: string | undefined; }
And in dev tools it shows up like this..
FileObject: Array(4)0: {date: "8/26/2020", cDataFileName: : "small_range_c-compressed.json", influenzaDataFileName: "mall_range_f-compressed.jso"}1: {date: "8-24-2020", cDataFileName: : "small_range_c-compressed.json", iDataFileName: : "mall_range_f-compressed.jso"}2: {date: "8-13-2020", cDataFileName: : "small_range_c-compressed.json", iDataFileName: : "mall_range_f-compressed.jso"}3: {date: "7-15-2020", cDataFileName: : "small_range_c-compressed.json", iDataFileName: : "mall_range_f-compressed.jso"}length: 4
What I need to be able to do is find if in FileObject data exists for a date of say "8/26/2020"
and get the cDataFileName and IDataFileName values for it.
const today = "8/26/2020"; console.log("testing" + FileObject [today as any]); // Its coming as testingUndefined. if (today in FileObject ) { console.log("today" + today); // Not even going there }
Please help me figure out a best way to iterate through this array of objects to get based on the date "8/26/2020" provided.
-----------Update 1----------This is how I had values aded to FileObject.
const FileObject: MyProps[] = []; FileObject.push({ date: file, cDataFileName: MycovidFileName, iDataFileName: MyinDataFileName, });