Created
January 24, 2010 18:21
-
-
Save itrelease/285352 to your computer and use it in GitHub Desktop.
This file contains 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
var Fruit = ["Apple", "Kinnow", "Mango", "Orange"]; | |
var Citrus = ["Lemon", "Kinnow", "Orange", "Tangerine"]; | |
function diffArrays (A, B) { | |
var strA = ":" + A.join("::") + ":"; | |
var strB = ":" + B.join(":|:") + ":"; | |
var reg = new RegExp("(" + strB + ")","gi"); | |
var strDiff = strA.replace(reg,"").replace(/^:/,"").replace(/:$/,""); | |
var arrDiff = strDiff.split("::"); | |
return arrDiff; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment