Skip to content

Latest commit

 

History

History
17 lines (12 loc) · 286 Bytes

File metadata and controls

17 lines (12 loc) · 286 Bytes
function Accumulator(startingValue) {
  this.value = startingValue;

  this.read = function() {
    this.value += +prompt('Quanto quer adicionar?', 0);
  };

}

let accumulator = new Accumulator(1);
accumulator.read();
accumulator.read();
alert(accumulator.value);