Created
December 10, 2018 12:57
-
-
Save NikitaGlukhi/098788d2fb5fc99f7324757969097d81 to your computer and use it in GitHub Desktop.
Task 3 for constructor function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Accumulator = function (startingValue) { | |
this.value = startingValue; | |
this.read = function () { | |
this.value += +prompt('Insert new value (task 3)', 0); | |
} | |
}; | |
const accumulator = new Accumulator(1); | |
accumulator.read(); | |
accumulator.read(); | |
alert(`Текукщее значение: ${accumulator.value}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment