I am trying to figure out the best way to compare two arrays.
Essentially I want to know the biggest and smallest array for further processing. Here is my code for doing so thus far:
merge: function(arrOne, arrTwo) {
if(arrOne == null || arrTwo == null) throw new Error();
var bigArr = arrOne.length > arrTwo.length ? arrOne : arrTwo,
smallArr = bigArr.length == arrOne.length ? arrTwo : arrOne;
console.log(bigArr);
console.log(smallArr);
}
While this works, I am guessing there has to be an easier and more efficient way of doing this. Any thoughts?
ifcould have been used, I would get a huge?and bludgeon that guy.console.log(window.foo)