title: Underscore.js - without and difference methods trouble
body: <p>I am trying to use the _.without and _.difference methods in the underscore.js library with no luck.</p>
  
  <p>Here is some code.</p>
  
  <pre><code>var someIds = _.pluck(parsedID1, 'id');
  var otherIds = _.pluck(parsedID2, 'id);
  </code></pre>
  
  <p>Here is where the trouble starts, I want to remove all of the otherIds out of the someId's list. So I have two options according to the website, either I can use _.difference || _.without. I use them like so...</p>
  
  <pre><code>var newArray = _.without(_.toArray(someIds), _.toArray(otherIds));
  </code></pre>
  
  <p>I have also tried to do this with _.difference as well, but I cant seem to get the methods to do anything other than return a copy of the first argument into the function. I have also tried passing the arguments into the functions without using the _.toArray() but the same thing happens.Has anyone ever encountered this error before? </p>
  
  <p>EDIT:</p>
  
  <p>I have tried the way as proposed below. I will give some more code in hopes of fixing this.</p>
  
  <p>The arrays that I am passing in as arguments are in the following format.</p>
  
  <pre><code>var array = ['100004191488120', '100004191488321'];
  </code></pre>
  
  <p>When I pass into the _.difference I do as follows:</p>
  
  <pre><code>var newArray = _.difference(someIds, otherIds);
  </code></pre>
  
  <p>If someIds length is 657 and otherIds is 57 I should be getting a result of 600 Id's. Instead I get a result of whatever the length of the first argument is, being 657.</p>
  
  <p>EDIT 2: Solved</p>
  
  <p>I figured out what the problem was, after all that frustration the problem lied with the second argument to difference I was passing in.</p>
  
  <p>I was doing a db query and getting back a list that looked like the following.</p>
  
  <pre><code>[{ _id: 514721152222111116666777, facebook: { id: '123456789' } },
   { _id: 514721152222111116666778, facebook: { id: '12345678' } },]
  </code></pre>
  
  <p>After I received those results I wanted to get the facebook id so I did the following,</p>
  
  <pre><code>var array = _.pluck(users, 'facebook.id');
  </code></pre>
  
  <p>Thats were the problem was, that pluck was sending me back a list of undefined. Instead I had to do 2 plucks before instead of one, like the following.</p>
  
  <pre><code>var temp = _.pluck(users, 'facebook'); 
  var arrayId = _.pluck(temp, 'id');
  </code></pre>
  
  <p>Thanks @ZenMaster for dropping the knowledge on the difference between _.without &amp;&amp; _.difference. Your answer was correct, was pretty brain-dead after a binder and didn't see the obvious.</p>