I'd like my function to return both an error code and a string value, so plan to use return to return the error code and use a parameter to return the string value. But it doesn't work. Looks like we can't return a value from function parameter. Any idea how to return it from function parameter?
Below is a sample code. I hope to get the retVal from sayHello's parameter.
function sayHello(name, retVal) {
retVal = "hello " + name;
return 1;
}