Anyone know how to recursively find and delete an object from an array structured like this with infinite nested objects with the same structure?
[
{
id: 1,
nest: [
{
id: 2,
nest: [{id: 3, nest: [{..continues..}]}],
},
{
id: 4,
nest...
Context: I have a form where a user enters in data. I want to remove all object elements in the phone array that contain an empty string in the phoneNumber property.
Here is example data:
const data =
[
{
contactName: "Contact 1 Name",
phone: [
{phoneName: "Some Name"...