This is the object for the array below.
function Employee (name,preference,man,max){
// Defines the object employee with the relevant fields
this.name = name;
// slot preference in order
this.preference = preference;
// Number of mandatory slots required
this.man = man;
// Maximum number of slots that can be allocated
this.max = max;
}
This is the array below. The second fields values (which represent slots in a timetable) are ordered by preference already. I want to be able to choose a particular slot and alert a list which contains all those who have it in their preference field and in order of who placed it of the highest preference.
var staff = new Array();
staff.push(new Employee("john",[1,2,3],1,3));
staff.push(new Employee("Conrad",[2,1,4],1,3));
staff.push(new Employee("Elliot",[8,2,6,7,1],3,5));
staff.push(new Employee("Sarah",[3,1,4,2,6],3,5));
staff.push(new Employee("Emily",[7,2,8,1,4],3,5));
staff.push(new Employee("Mark",[3,4,1,2],1,3));
staff.push(new Employee("Lucy",[5,1,4],1,3));
staff.push(new Employee("Sam",[6,2,7],1,3));
showEmployees(staff);