const jonas = {
  firstname: "Jonas",
  lastName: "Schmedtmann",
  birthYear: 1986,
  job: "developer",
  friends: ["Nika", "Joanne", "Eva"],
  hasDriversLicence: false,

  //   calcAge: function () {
  //     console.log(this); // Ausgabe des eigenen Objektes
  //     return new Date().getFullYear() - this.age;
  //   },
  calcAge: function () {
    this.age = new Date().getFullYear() - this.birthYear;
    return this.age;
  },

  getSummary: function () {
    this.summary = `${this.firstname} is a ${this.age} old ${this.job} and he ${
      this.hasDriversLicence ? "has" : "has not"
    } a driver's license`;
    return this.summary;
  },
};

// console.log(jonas.calcAge(1986));
// console.log(jonas["calcAge"](1985));

// console.log(jonas["calcAge"]); // Ausgabe der Definition der Methode calcAge()

console.log(jonas.calcAge());
console.log(jonas.age);
console.log(jonas.age);
console.log(jonas.age);

// console.log(jonas.getSummary());
console.log(jonas.summary);
