Can I reference an Event by its ID?

This has been giving me fits for a long time.

Is there a way I can retrieve an Event (that is, one of the Events on the current $gameMap, in Object form) if I know its Event ID?

I need to retrieve the event object to get some of its properties, such as its _x value.

I would prefer a solution that doesn't require looping through every event on the map to check its Event ID, for performance reasons (as this functionality is already inside a loop that repeats a bunch). However, if this is the only way to do it, I'll appreciate your help in setting up this loop (since I might be unclear on what the $gameMap.events() array actually holds).

Thank you!!
events can be retrieved but each map ID holds its events is, if MAP 0001 has 5 events, it has events ID 1 through 5,
if MAP 0004 has 5 events, even this map has eevent ID 1 through 5.

if you have named them you can use teh search for events that retrieve its map and events that hold the name.
so the $gameMap.events() hold teh events on that MAP ID
I prefer to reference $gameMap._events, since most Events have an Id that corresponds to their index within that Array, whereas $gameMap.events() truncates the null value from $gameMap._events.

So, an instance of Game_Event has an _eventId property, which, as far as I know, should be its index within $gameMap._events:

Code:
Game_Event.prototype.demoFunction = function() {
  console.log($gameMap._events[this._eventId]); // For example
};
There is a function by default that yields you exactly that too:
Code:
Game_Map.prototype.event = function(eventId) {
    return this._events[eventId];
};
Everyone, I appreciate your help so much!! 🙏

I ended up going with @Another Fen's suggestion, which seems like the most straightforward way to reference the object for my purposes, and it worked like a charm. Had no idea that the event() function existed!

Original thread: https://forums.rpgmakerweb.com/threads/can-i-reference-an-event-by-its-id.110724/