FrontEnd.ro logo
Proprietăți Private

class CreditCard {
  constructor() {
    this.number = '....';
  }

  getNumber() {
    return this.number;
  }

  getInfo() {
    const lastFour = this.getNumber().slice(-4);
    return `Last four numbers: ${lastFour}`;
  }
}