I have an array that looks like below
process:Array[3]
0:Object
office_id:""
1:Object
office_id:6
2:Object
office_id:""
I want to check if office_id named key is not empty
If I find at least one office_id that is not empty it will return true else if all is empty it will return false.
The default value of office_id is empty string as you can see.
The object is dynamic since I'm using some input select form to add another object with office_id so if they select something another object will be added with office_id equal to that specific select id.
Now, as for validation purpose I need to check if the object process contains an office_id with a numeric value.
office_id- though, reading between the lines ...process.some(i => i.office_id)will be true if at least one object in theprocessarray has a non-falseyoffice_idproperty - however, anoffice_id:0would not count as "truthy" ... so .. perhaps ...process.some(i => typeof i.office_id === 'number')[{office_id:""}, {office_id:""},{office_id:""}].some(obj => typeof obj.office_id === "number"), but you should first decide what "office_id is empty" actually means: empty string only? missing? undefined? null? 0? NaN? date?