Module2: Demo add 2 numbers

Module2_Improving_Readability_with_Arrow_functions
jason.zhu 2021-05-12 12:11:47 +10:00
parent c38c66a446
commit a3c7a49770
1 changed files with 3 additions and 11 deletions

14
app.js
View File

@ -1,12 +1,4 @@
function setupCounter(val) { let sum2 = (num1, num2) => num1 + num2;
return function counter() {
return val++;
}
}
let counter1 = setupCounter(0); let output = sum2(10,5);
console.log(counter1()); console.log(output);
console.log(counter1());
let counter2 = setupCounter(10);
console.log(counter2());
console.log(counter2());