How to implement map instead of for loop in javascript : 
> I have two json arrays(req[],res[]) which need to be compared and the differences should display in log,for this I am using for loop,But i want to use map for solving this problem.

Note: Need to sort both the arrays first 

  

      
     for(var i=0;i<req.length;i++)
     
       {
    	if(req[i]!==res[i])
    	{
    		console.log('unmatched element 	: '+req[i]+' and '+res[i]);
    	}
    	else
    	{
    	continue;
    	}
        }


So how can i use map to sort both the arrays using some attribute like(id or name) and then compare both the arrays and print error with values when match fails .


