Skip to content

Commit

Permalink
resolved task 2 from chapter 4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
moiseenkov committed Jun 29, 2022
1 parent fa374bd commit 4f694ff
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
16 changes: 16 additions & 0 deletions exercises/chapter_04.5_task_2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<script src="https://ru.js.cx/test/libs.js"></script>
<script src="test.js"></script>
<script>

function Accumulator(stringValue) {
this.value = Number(stringValue),

this.read = function(stringValue) {
this.value += Number(stringValue);
}
};

</script>

</html>
10 changes: 10 additions & 0 deletions exercises/chapter_04.5_task_2/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
describe("Calculator", function() {

context("Simple tests", function() {
it("Begin from 4 and add 2 = 6", function() {
let acc = new Accumulator("4")
acc.read("2")
assert.equal(acc.value, 6);
});
});
});

0 comments on commit 4f694ff

Please sign in to comment.