Last active
August 29, 2015 14:05
-
-
Save lelinhtinh/d8155281d3522444ccb9 to your computer and use it in GitHub Desktop.
Lấy ra mảng khác biệt từ 2 mảng, Trừ 2 mảng trong javascript
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
// http://stackoverflow.com/a/8211012 | |
var array1 = ["test1", "test2", "test3", "test4"]; | |
var array2 = ["test1", "test2", "test3", "test4", "test5", "test6"]; | |
var _array = new Array(); | |
_array = jQuery.grep(array2, function(item) { | |
return jQuery.inArray(item, array1) < 0; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment