i have two object arrays in js.dummy arrays are shown below.
arr1=[{'id':1,'name':'David'},
{'id':2,'name':'Miles'},
{'id':3,'name':'John'},];
arr2=[{'id':2,'age':22},
{'id':3,'age':18},
{'id':1,'age':12},];
Can i sort arr1 in same order of ids as arr2. so arr1 becomes
[{'id':2,'name':'Miles'},
{'id':3,'name':'John'},
{'id':1,'name':'David'},];
actual arrays have some 900 objects each.so is there any efficient method of achieving this?