I have an array of objects with one property being an array of values without keys and I am attempting to filter through and check for matching values within the nested array. Here is an example of one object:
[ 0:
{ fiber_phases: ["45", "46"],
id: 1,
label: "3200 to 3299 1 1/2 ST N",
max_number: "3299",
min_number: "3200",
parsed_hash: "4028c7befc61ba4d07189f6ba99de35f",
street: "1 1/2 ST N"
}
]
Here is my javascript code thus far:
return this.blocks
.filter((block) => block.fiber_phases === fiberPhase)
.map(({id, label, max_number, min_number, street, parsed_hash, fiber_phases}) => ({id: id, label: label, max_number: max_number, min_number: min_number, street: street, parsed_hash: parsed_hash, fiber_phases: fiber_phases}))
It's pretty clear that I'm not actually going into the nested array, but I haven't been able to access it.
I am attempting to filter through and check for matching values within the nested array.is definitely not clear.block.fiber_phases === fiberPhasedid you intend to doblock.fiber_phases.includes(fiberPhase)?fiber_phases, and check for matches based on one fiberPhase value (i.e. let fiberPhase = '46'). I then would like to return a new array of objects that match that value.id: id,just doid,