Having trouble merging two complex arrays? Let's simplify it for you:
var array1 = [['email1', object1],['email2', object2],['email3', object3],['email4',object4]]
var array2 = [['email1',[['a1','b1']]],['email3',[['a3','b3']]], ['email4',[['a4','b4'],['a4a','b4a']]]
All you need to do is merge them by email, eliminating duplicates in the process:
var mergedarray =
[['email1', object1, [['a1', 'b1']]],['email2', object2],['email3', object3, ['a3', 'b3']],['email4',object4,[['a4','b4'],['a4a','b4a']]]]
No need to overthink those multi-dimensions! Need any help with this?