title: what is better approach to use slice or splice when remove element from an array?
body: <p>Because of high data volume i have set array <code>$scope.event</code> size limit so when it reaches <code>BufferLimit</code> remove first item from an array and add latest item to array. What is best approach to use <code>slice</code> or <code>splice</code> in terms of high data volume when you remove add item ?</p>
  
  <p>Ctrl.js</p>
  
  <pre><code>$scope.event = [];
      function safelyAdd(element) {
          if (totalReceived &gt; Bufferlimit &amp;&amp; $scope.event.length) {
  
              $scope.event = $scope.event.slice(1); //delete first element in $scope.event
  
              totalReceived -= $scope.event[0].messageSize; //total message size minus deleted message size
              console.log('totalReceivedBytes', totalReceived);
              // $scope.event =[];//reset array if max size reached..
              console.log('$scope.event', $scope.event)
          }
          console.log('$scope.event.length', $scope.event.length);
  
              $scope.event.push(element); //then push new item..
  
      }
  </code></pre>