I have done several searches on the Internet, and I have found how to return two values in a function, and then how to access them, but what I need is to use a function to which a parameter passed and which in turn returns two values, I know this can be done in PHP, but I do not know how to do it in javascript
.
Let me explain myself a little better:
function ObtenerDate(valor){
....
var valor_final = getHours();
var date = getDate();
return [valor_final , date ]
}
Later I call the GetDate () function
for(i = 0; i<array.length; i++){
var values = ObtenerDate();
arreglo[i] = values[0](array[i]); //ESTO NO ME FUNCIONA
}
The problem is when I call the GetDate function, accessing the position 0 or 1 I get data, but I do not know how to pass parameters that I need it for the function to work. I need to do
for
because in each cycle offor
I call the function GetDate ()
EDIT (Adding information)
The variable array
found in the for
is where I store a set of dates in the UNIX EPOC type.
In the ObtenerDate()
function is where I convert the date of array to the Y-m-d
In arreglo[i]
is where I save the date already converted
Thanks in advance.