Consider two arrays, Array1 and Array2, that need to be compared based on the following three rules:
Rule 1:
Array1=[en,fr,eg];
Array2=[{lang:en},{lang:eg}]
The comparison result will be:
Result=[{lang:en},{lang:fr,Maybe:i_can_add_other_Attribute},{lang:eg}]
Rule 2:
If Array1=[en,fr,eg]
and Array2=[{lang:en},{lang:fr}]
, then the result should be Result[{lang:en},{lang:fr}]
Rule 3:
Array2 must be arranged in the sequence of Array1. For example:
Array1=[en,fr,eg]
Array2=[{lang:fr},{lang:en},{lang:eg}]
In this case, the result should become:
Result=[{lang:en},{lang:fr},{lang:eg}]