Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

loopy diff array

node v0.12.18
version: 1.0.0
endpointsharetweet
function diff(arr1, arr2) { var newArr = arr1.concat(arr2); var finArr = []; for (i=0; i<newArr.length; i++){ if (arr1.indexOf(newArr[i]) === -1 || arr2.indexOf(newArr[i]) === -1) { finArr.push(newArr[i]) } } // Same, same; but different. return finArr }
Loading…

no comments

    sign in to comment