Skip to content

Instantly share code, notes, and snippets.

@skamithi
Last active August 29, 2015 14:16
Show Gist options
  • Save skamithi/6fae1a2f6e571f558622 to your computer and use it in GitHub Desktop.
Save skamithi/6fae1a2f6e571f558622 to your computer and use it in GitHub Desktop.
comparing arrays
# requires underscore.js
_und = require 'underscore'
a = [1,2,3,4]
b = [4,3,2,1]
_und.difference(a,b) == []
a = [1,2,3,4]
b = [4,3,2,1]
set(a) == set(b)
require 'set'
a = [1,2,3,4].to_set
b = [4,3,2,1].to_set
a == b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment