+ 1

What happens to whatever the return statement returns?!?

26th Nov 2016, 10:45 AM
CodingRobotics
CodingRobotics - avatar
2 Answers
+ 5
the function behaves like the value itself it returns var a=1;. a is 1 var b=a. b is value of a that is 1; var c=sqr(3) here c is sqr(3) now the function returns 9 so whole behaves as 9 9 is the value it returned.
26th Nov 2016, 11:49 AM
Sandeep Chatterjee
+ 1
function myFunc() { ... return 1; } var x = myFunc(); // x is 1
26th Nov 2016, 11:28 AM
Samuel Neo
Samuel Neo - avatar