Is there a way to use a sort of the C#-like out
or ref
parameter modifiers with Javascript to do something like this:
function myManyReturnFunction(number1, number2, out x, out y) {
x = number1 * number2;
y = number1 / number2;
return true;
}
var height1, height2 = 0;
var check = myManyReturnFunction(1,1, out height1, out hight2);
I would like to change the variable's reference as well. So yes, passing an argument by reference.
function myManyReturnFunction(number1, number2) {
return {
x: number1 * number2,
y: number1 / number2
}
}
And you don't need x
and y
parameters, simply call:
var result = myManyReturnFunction(6, 9);
var x = result.x;
var y = result.y;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With