8 lines
154 B
JavaScript
8 lines
154 B
JavaScript
function Accumulator(startingValue) {
|
|
this.value = startingValue;
|
|
|
|
this.read = function() {
|
|
this.value += +prompt('How much to add?', 0);
|
|
};
|
|
|
|
}
|