-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction-example.js
More file actions
37 lines (31 loc) · 892 Bytes
/
Copy pathfunction-example.js
File metadata and controls
37 lines (31 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
function functionName (parameters){
function body
return
}
var returnedValue = functionName(parameters value)
console.log(returnValue);
*/
/* 27) Write a function called make_avg() which will take an three integers and
return the average of those values. */
/*
function getAverage(assignment1, assignment2, assignment3) {
const total = assignment1 + assignment2 + assignment3;
const average = total / 3;
return average;
}
const assignment1Marks = 60;
const assignment2Marks = 58;
const assignment3Marks = 59;
var myAverage = getAverage(assignment1Marks, assignment2Marks, assignment3Marks);
console.log('my average so far: ', myAverage);
*/
function add(num1, num2) {
const sum = num1 + num2;
return sum;
}
const result1 = add(25, 25);
// console.log()
const result2 = add(20, 20);
const finalResult = add(result1, result2);
console.log(finalResult);