title: Why does adding [0] after the delete count in splice() return just a number?
body: <p>First of all sorry for the long title, I really didn't know how to word it better.</p>
  
  <p>In the middle of solving _.shuffle in underscore, I encountered the use of splice. Here is my original code :</p>
  
  <pre><code>shuffle = function(array) {
    var shuffledArray = [];
    var total = array.length;
    var copiedArray = array.slice();
    while (total){
      var randomNum = Math.floor(Math.random() * total);
      shuffledArray.push(copiedArray.splice(randomNum,1));
      total--;
    }
    return shuffledArray;
  };
  var originArray = [1, 2, 3, 4];
  console.log(shuffle(originArray));
  </code></pre>
  
  <p>However after testing just I realized it will return each value inside a [ ], instead of just the value.</p>
  
  <p>i.e.</p>
  
  <pre><code>[ [ 4 ], [ 3 ], [ 1 ], [ 2 ] ]
  //instead of [ 4, 3, 1, 2]
  </code></pre>
  
  <p>When I changed this line (added '[0]' after the deleteCount in splice)</p>
  
  <pre><code>shuffledArray.push(copiedArray.splice(randomNum,1));
  </code></pre>
  
  <p>into this </p>
  
  <pre><code>//edited
  shuffledArray.push(copiedArray.splice(randomNum,1)[0]);
  </code></pre>
  
  <p>the return array that I get is what I wanted, which is </p>
  
  <pre><code>[ 3, 1, 2, 4 ] //values are not in [ ]
  </code></pre>
  
  <p>Can someone explain how adding [0] after splice() makes the value not return in [ ] or why not having [0] does?</p>