- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11_function_return.js
More file actions
Latest commit
33 lines (25 loc) · 662 Bytes
/
Copy path11_function_return.js
File metadata and controls
33 lines (25 loc) · 662 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
// return for values if not define use values
// will undefined
functionsum(num1,num2){
letcalculate=num1*num2;
return'the values num1 and num2 is '+calculate;
}
constnumber1=sum(100,200);
constnumber2=sum(100,50);
constcalculate=[number1,number2];
console.log(calculate);
//if without return will undefined so use return
/*
function calculate(values) {
console.log('values number is ' + values);
}
const width = calculate(100);
const height = calculate(100);
// here for add to array
const dimensions = [width, height];
console.log(dimensions);
output
values number is 100
values number is 100
[ undefined, undefined ]
*/