function Accumulator(startingValue){ this.value = startingValue; this.read = function(){ new_value = +prompt("value?", 0); this.value += new_value; } } let accumulator = new Accumulator(1); accumulator.read(); alert(accumulator.value);