Code is not executed in Processing, but in p5.js Web Editor

If you need to pick the last device found you can do this instead:
exact: deviceList[deviceList.length - 1].id

If you’ve got a more updated browser you can shorten it using method at():
exact: deviceList.at(-1).id

Another option is picking a random device:
exact: random(deviceList).id