There is an easy way…
$(arr1).not(arr2).length === 0 && $(arr2).not(arr1).length === 0
If the above returns true, both the arrays are same even if the elements are in different order.
NOTE: This works only for jquery versions < 3.0.0 when using JSON objects
More Related Contents:
- Converting a JS object to an array using jQuery
- Remove array element based on object property
- Why does typeof array with objects return “object” and not “array”? [duplicate]
- How to add an object to an array
- Filter array of objects with another array of objects
- Find and remove objects in an array based on a key value in JavaScript
- break array of objects into separate arrays based on a property
- Find object having maximum value for the `id` property in an array of objects
- Sorting array of object based on range of Numbers of String [closed]
- How to get all the values associated with an object in array?
- How to remove all duplicates from an array of objects?
- Sort array of objects by single key with date value
- Check if an array is empty or exists
- Why Array.indexOf doesn’t find identical looking objects
- How to count the number of occurrences of each item in an array? [duplicate]
- What is the performance of Objects/Arrays in JavaScript? (specifically for Google V8)
- Javascript string array to object [duplicate]
- Get unique results from JSON array using jQuery
- Create an empty object in JavaScript with {} or new Object()?
- Compare 2 arrays which returns difference
- jQuery: How to get the event object in an event handler function without passing it as an argument?
- Javascript algorithm to find elements in array that are not in another array
- What does $(selector)[0] mean in jQuery?
- Getting index of an array’s element based on its properties
- JavaScript: Remove duplicates of objects sharing same property value
- Can I append an array to ‘formdata’ in javascript?
- Create array of all integers between two numbers, inclusive, in Javascript/jQuery
- Sorting an Array of JavaScript Objects a Specific Order (using existing function)
- Node.js – console.log does not show items in array but instead shows [Object]
- How can I remove an element from a list, with lodash?