1

I have two objects like this:

{ Id: 8, ProductGroups: [{ ProductGroupId: 1, show: false }, { ProductGroupId: 2, show: false }], DependantAnswers: [{ QuestionId: 6, answer: "female" }] },
{ Id: 9, ProductGroups: [{ ProductGroupId: 1, show: false }, { ProductGroupId: 2, show: false }], DependantAnswers: [{ QuestionId: 6, answer: "female" }, { QuestionId: 8, answer: "yes" }] }

I'm trying to separate them only to manipulate with object 8, but whichever if in .each I try, object with Id 9 passes because it has same DependantAnswers like object with Id 8.

Mark West
  • 45
  • 6
  • Are these object in an array? It would help to see more of the data structure, and also the code you've written that interacts with them – Rory McCrossan Mar 23 '17 at 07:37
  • The problem with that question - as with this one - is that it's really not clear what your goal is. You're describing a problem, not what you want to achieve. From the description I'm guessing you want to retrieve a single object from the array buy its `id`? If so, this question will help: http://stackoverflow.com/questions/7364150/find-object-by-id-in-an-array-of-javascript-objects – Rory McCrossan Mar 23 '17 at 07:47

0 Answers0