11 6 1 1 functions can call other functions c2 b6

Solutions on MaxInterview for 11 6 1 1 functions can call other functions c2 b6 by the best coders in the world

showing results for - "11 6 1 1 functions can call other functions c2 b6"
Karl
29 Sep 2019
1/*Functions should only accomplish one (preferably simple) task. To solve 
2more complicated tasks, one small function must call other functions.*/
3
4function addTwoToNumber(num){
5   return num += 2;
6}
7
8function addFiveToNumber(value){
9   let result = addTwoToNumber(value) + 3;
10   return result;
11}
12
13console.log(addFiveToNumber(12))
14
1517
16
17/*Of course, there is no need to write a function to add 5 to a value, 
18but the example demonstrates calling a function from within another 
19function.*/