We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bfa6467 commit cbd9844Copy full SHA for cbd9844
JavaScript/1-simple.js
@@ -1,7 +1,7 @@
1
'use strict';
2
3
function inc(a) {
4
- return ++a;
+ return a + 1;
5
}
6
7
const sum = function(a, b) {
@@ -10,6 +10,12 @@ const sum = function(a, b) {
10
11
const max = (a, b) => (a > b ? a : b);
12
13
+const avg = (a, b) => {
14
+ const s = sum(a, b);
15
+ return s / 2;
16
+};
17
+
18
console.log('inc(5) = ' + inc(5));
19
console.log('sum(1, 3) = ' + sum(1, 3));
20
console.log('max(8, 6) = ' + max(8, 6));
21
+console.log('avg(8, 6) = ' + avg(8, 6));
0 commit comments