let's say I have the following data array
["New York", "Madrid", "Roma"]
And I have 2 other variables and another array
firstValue = '';
middlesValues = []
lastValue = ''
output
firstValue = 'New York'
middlesValues = ['Madrid']
lastValue = 'Roma'
And I would like for example to put the first value in the array each time in a variable, the middle values in an array and the last value in the last variable. And if I have only two values in the array, to put only the first value and the last one in the 2 variables.
How can I proceed.