Say I have a function
function myFunction(myValue) {
// do something
}
How would I return a value from this, say a string type after the method is executed?
Say I have a function
function myFunction(myValue) {
// do something
}
How would I return a value from this, say a string type after the method is executed?
Use the return
statement, just like you would with any other JavaScript function:
return "Hello";
https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/return
function myFunction(myValue) {
// do something
// return to caller of function:
return myValue;
}
var result = myFunction(myValue);