Try using pop() and storing the last value in the devices array inside a variable.

Make sure to assemble var items = devices.pop();.