-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1.js
More file actions
22 lines (17 loc) · 644 Bytes
/
1.js
File metadata and controls
22 lines (17 loc) · 644 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Predict and explain first...
// =============> the function so will not perform a + b and will return undefined in the
console.log function
function sum(a, b) {
return;
a + b;
}
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
// =============> I think there shouldn't be a semi-colon after return
// this will signify the end of function so a + b will not be performed
// therefore there is no answer to return to print in the console.log function
// Finally, correct the code to fix the problem
// =============>
// function sum(a, b) {
// return a + b;
// }
// console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);