(a, b)
| 173 | |
| 174 | // Returns a new Array with the elements that are in a but not in b |
| 175 | function diff(a, b) { |
| 176 | var i, |
| 177 | j, |
| 178 | result = a.slice(); |
| 179 | |
| 180 | for (i = 0; i < result.length; i++) { |
| 181 | for (j = 0; j < b.length; j++) { |
| 182 | if (result[i] === b[j]) { |
| 183 | result.splice(i, 1); |
| 184 | i--; |
| 185 | break; |
| 186 | } |
| 187 | } |
| 188 | } |
| 189 | return result; |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * Determines whether an element exists in a given array or not. |