I currently split a list in json to first 10 and the second is 11 to 20. However, I want to split it to half for any length of the list. How can I do it?
This is my code
  function loadTop() {
    $webServicesFactory.get($marketProvider[$scope.currentMarket].topGetURL, {AnonymousToken: $marketProvider[$scope.currentMarket].token}).then(
      function success(response) {
        $scope.top = response.Stock.slice(0, 10);
        $scope.low = response.Stock.slice(10, 20);
        console.log($scope.top);
        loadStockCount();
        loadTop();
        loadLow();
        $ionicLoading.hide();
      },
      function error(error) {
        $ionicLoading.hide();
      }
    );
  }
 
    