FrontEnd.ro logo
Proprietăți Private

function newCreditCard() {
  const number = '...';
  
  function getNumber() {
    return number;
  }

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