{"size": 986, "ext": "js", "max_stars_repo_path": "src/airport.js", "max_stars_repo_name": "lwkchan/the-legendary-airport-js", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/airport.js", "max_issues_repo_name": "lwkchan/the-legendary-airport-js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/airport.js", "max_forks_repo_name": "lwkchan/the-legendary-airport-js", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.9302325581, "max_line_length": 54, "alphanum_fraction": 0.5750507099}
var Airport = function(){
  this.hangar = [];
};

const HANGAR_CAPACITY = 5;

Airport.prototype.isStormy = function(){
    var chance = Math.floor((Math.random() * 10) + 1);
    if (chance < 3) {
      console.log("It's stormy");

        return true;
    } else {
      console.log("Not stormy");
        return false;
    }
};

Airport.prototype.land = function(plane) {
  if (this.isStormy()===true) {
    console.log("NO! NO LAND STORMY");
  } else if (this.hangar.length === HANGAR_CAPACITY){
      throw new Error("Hangar is full");
  } else {
    console.log("Plane has landed");
    this.hangar.push(plane);
  }
};

Airport.prototype.takeoff = function(plane) {
  if (this.isStormy()===true) {
    console.log("NO! NO TAKEOFF STORMY");
  } else {
      var index = this.hangar.indexOf(plane);
      if (index === -1) {
        console.log("NO! NO PLANE EXIST");
      } else {
        this.hangar.splice(index, 1);
        console.log("Plane has taken off");
      }
    }
  };
