How to create an event

How do you pro-grammatically create an event in JavaScript, as you can in the editor? 
That is a bad way to do this, because programming an event is extremely complex.


What people usually do is create a master map with all the needed dynamic events in the editor and then copy/clone the event from there.


Even that usually requires a script, but those scripts already exist, search for them

Original thread: https://forums.rpgmakerweb.com/threads/how-to-create-an-event.55880/