Skip to content

Commit 9d51421

Browse files
committed
1 parent ee0a414 commit 9d51421

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Exercises/2-by-value.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
'use strict';
2+
const inc = x => ++x;
23

3-
const inc = null;
4+
const a = 5;
5+
const b = inc(a);
6+
console.dir({ a, b });
47

58
module.exports = { inc };

Exercises/3-by-reference.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
'use strict';
22

3-
const inc = null;
3+
const inc = function (obj) {
4+
obj.n++;
5+
};
6+
const obj = { n: 5 };
7+
inc(obj);
8+
console.dir(obj);
49

510
module.exports = { inc };

0 commit comments

Comments
 (0)