Write a function named addEvent that takes an argument named eventList, which is the head cell of a linked list of events in the form below, and an argument newEvent and creates a new list cell containing the new event data and inserts it into the list in chronological order. Return eventList at the bottom of the function.

var event1 = { type: "detonation", loc_x: 77, loc_y: 27, time: 29384 };
var event2 = { type: "unitStartMove", unitID: 345, time: 32765 };
var event3 = { type: "detonation", loc_x: 79, loc_y: 27, time: 33341 };

var tail = { next: null };
var cell3 = { data: event3, next: tail };
var cell2 = { data: event2, next: cell3 };
var cell1 = { data: event1: next: cell2 };
var head = { next: cell1 };

javascript programming
exercise: functions 10