How to access first element of JSON object array with JavaScript?

To access first element of JSON object array with JavaScript, we use index 0.

For instance, we write

const req = { events: [{ event: "inbound", ts: 1426249238 }] };
console.log(req.events[0]);

to get the req.events array property and get its first item with index 0 in the square brackets.