Last active
August 29, 2015 14:16
-
-
Save skamithi/6fae1a2f6e571f558622 to your computer and use it in GitHub Desktop.
comparing arrays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# requires underscore.js | |
_und = require 'underscore' | |
a = [1,2,3,4] | |
b = [4,3,2,1] | |
_und.difference(a,b) == [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = [1,2,3,4] | |
b = [4,3,2,1] | |
set(a) == set(b) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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