title: Stuck using array.splice() to shuffle a deck array
body: <p>I'm trying to randomly shuffle a deck array of <code>Card</code> objects into a <code>newDeck</code> array of <code>Card</code> objects using <code>array.splice()</code>.  I imagine my problem is either something to do with variable scope, or a misapprehension about <code>array.splice()</code>.</p>
  
  <pre><code>var deck = [new Card(), new Card(), new Card(), new Card(), new Card(), new Card()];
  var newDeck = [];
  var shuffle = function(){
      var i = "";
      for (i = 0; i &lt; deck.length; i++){      
          newDeck[i] = deck.splice(Math.floor(Math.random() * deck.length, 1));
  }    
  };
  
  shuffle();
  </code></pre>
  
  <p>Is there a better way to shuffle a deck?</p>