1
resposta

data.getTime() is not a function

To tendo esse erro ai falando que getTime não e uma função

class Negociacao {
  constructor() {
    this._data = new Date(data.getTime());
    this._quantidade = 1;
    this._valor = 0;
    Object.freeze(this);
  }

  get volume() {
    return this._quantidade * this._valor;
  }

  get data() {
    return new Date(this._data.getTime());
  }

  get quantidade() {
    return this._quantidade;
  }
  get valor() {
    return this._valor;
  }
}}
1 resposta

Fala ai Nati, tudo bem? Acho que faltou receber a data no construtor da classe, algo assim:

constructor(data) {
    this._data = new Date(data.getTime());
    this._quantidade = 1;
    this._valor = 0;
    Object.freeze(this);
  }

Espero ter ajudado.