We'll use Ramda's equals
function, but instead we can use Lodash's or Underscore's isEqual
:
const R = require('ramda');
const arraysHaveSameValues = (arr1, arr2) => R.equals( [...arr1].sort(), [...arr2].sort() )
Using the spread opporator, we avoid mutating the original arrays, and we keep our function pure.