anchor.diff:            });
             $(".modal-body").html(purchasesString);
           });
  +        console.log(nextId, numberOfPastPlans)
         }
       });
     });
  
positive.code: 
  <script type="text/javascript" charset="utf-8">
  $(function () {
    $(".js-previous").on("click", function() {
      var nextId = parseInt($(".js-previous").attr("data-id")) - 1;
      var numberOfPastPlans = parseInt($(".js-pager").attr("data-count")) - 1;
      $.get("/plans/" + nextId + ".json", function(data) {
        var date = new Date(data["date"]);
        var month = [];
        month[0] = "January";
        month[1] = "February";
        month[2] = "March";
        month[3] = "April";
        month[4] = "May";
        month[5] = "June";
        month[6] = "July";
        month[7] = "August";
        month[8] = "September";
        month[9] = "October";
        month[10] = "November";
        month[11] = "December";
        $(".modal-title").text(`In ${month[date.getMonth()]} you budgeted...`);
  
        var purchases = data["purchases"];
        var purchasesString = "";
  
negative.code:         purchasesString += `<p data-paymentid="${purchase["id"]}">` + "$" + `${purchase["price"]} ` + "for " + `${purchase["item"]} ` + "</p>";
        });
        $(".modal-body").html(purchasesString);
        console.log(nextId, numberOfPastPlans)
      });
      $(".js-pager").on("click", function() {
        if (numberOfPastPlans === 0) {
          $("#myModal").modal('hide');
          numberOfPastPlans = parseInt($("js-pager").attr("data-count"))
        } else {
          numberOfPastPlans--;
          nextId--;
          $.get("/plans/" + nextId + ".json", function(data) {
            $(".modal-title").text(`In ${prettifyMonth(data["date"])} you budgeted...`);
            var purchases = data["purchases"];
            var purchasesString = "";
            $.each(purchases, function(i, purchase) {
  