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}`;
  }
}