Solution
define(['underscore'],
(_) => {
//expResponse and slResponse are JSON array of objects
const compare=(expResponse,slResponse)=>
{
return _.isEqual(expResponse,slResponse)
}
});
//to use this isEqual function define them by using library 'underscore'
//here it returns true if all key value pairs match with the other object