anchor.diff:  $(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 = [];
  
positive.code:       $(".modal-body").html(purchasesString);
      });
      $(".js-pager").on("click", function() {
        nextId--;
        $.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 = "";
          $.each(purchases, function(i, purchase) {
            purchasesString += `<p data-paymentid="${purchase["id"]}">` + "$" + `${purchase["price"]} ` + "for " + `${purchase["item"]} ` + "</p>";
          });
          $(".modal-body").html(purchasesString);
        });
      });
    });
  });
  
negative.code:   <h4>Income still available: <strong><%= number_to_currency(@plan.income_available) %></strong></h4>
    <small><%= link_to "Edit income", edit_plan_path %></small>
  </div>
  
  <!-- Button trigger modal -->
  <button type="button" class="btn btn-default js-previous" data-toggle="modal" data-target="#myModal" data-id="<%= @plan.id %>">
    Previous plans
  