function equalArrayElements (needle, haystack) {
  let missingNeedle = needle.filter(n => haystack.indexOf(n) === -1)
  if (missingNeedle.length !== 0) {
    return false
  }

  let missingHaystack = haystack.filter(h => needle.indexOf(h) === -1)
  return missingHaystack.length === 0
}
function equalArrayElements (needle, haystack) {
  let missingNeedle = needle.filter(n => haystack.indexOf(n) === -1)
  if (missingNeedle.length !== 0) {
    return false
  }

  let missingHaystack = haystack.filter(h => needle.indexOf(h) === -1)
  return missingHaystack.length === 0
}
function equalArrayElements ( needle , haystack ) { let missingNeedle = needle . filter ( n => haystack . indexOf ( n ) === - 1 ) if ( missingNeedle . length !== 0 ) { return false } let missingHaystack = haystack . filter ( h => needle . indexOf ( h ) === - 1 ) return missingHaystack . length === 0 }
See if two arrays contain the same elements
See if two arrays contain the same elements