0

i try to return an array from a function:

function test (CAR,DATE) {
some XMLHttp Request <- Works
var arrayTrip = JSON.parse(xhrTrip.response); <- Works
console.log(arrayTrip); <- Works
return arrayTrip; <- unsure

}
var test = new myTest(input,time); <- unsure
console.log(test); <- not the array as in console.log(arrayTrip)

But this is not working. Is there any way to receive the array?

Kra3h
  • 1
  • 1. Please update with more detail of your code instead of "some XMLHTTP"; 2. What did console print? – Thanh Dao Apr 08 '22 at 09:39
  • I would change `var test = new myTest(input,time); <- unsure` to `var result = test(input,time); <- unsure`. no need for `new` and the function is called `test` and not `myTest` – Carsten Løvbo Andersen Apr 08 '22 at 09:41

0 Answers0