Question:
So I’m trying to switch the value of selected from whatever. Value is the opposite. It’s for a checkbox. Idk maybe lack sleep but I’m having the hardest time trying to figure this out. Here’s the data structure. It’s JSON with arrays that have objects.Answer:
Without knowing all the requirements you have for your code, I’m just focusing on how to remove the unwanted nesting of the arrays. You can simplify your code as well with this solution. Next step would be to decide if you’re wanting the values copied / how deep you want to copy the array and if the toggle logic is indeed what you’re after.If you have better answer, please add a comment about this, thank you!