0
Can a function return two values. for eg. return var1; return var2
2 Answers
+ 13
if they are separated by some logic, sure. but once a return statement is encountered the function ends
+ 9
If you need to return multiple values, you could use an object with properties for those values.
Example:
return {
var1: someValue,
var2: anotherValue
};