Will I get an error if I use the map function on an empty array?

I am using an API module to get some information from Stripe. The body of the response may contain an empty array if nothing is found. If I use the map function on this array will I get an error message, or will that also return an empty array?

Many thanks

Hi @Liz_Hamilton,

You will get an empty array if the array is empty.

And, you won’t get any error, the only time I believe map function tyrows an error is if you pass object/collection instead of array as an input.

1 Like

There will be no error from the map function if the input array is empty.
You can test the same as shown below:

1 Like

Thank you both. That is what I was hoping to hear

Thank you, that is what I was hoping to hear

1 Like