Skip to content

Instantly share code, notes, and snippets.

@benevolent0505
Last active August 29, 2015 14:22
Show Gist options
  • Save benevolent0505/e5db5f46dfa57f5ee7cd to your computer and use it in GitHub Desktop.
Save benevolent0505/e5db5f46dfa57f5ee7cd to your computer and use it in GitHub Desktop.
var TimeSchedule = function() {
this.timeSchedule = [
[], [], [], [], [], [], []
];
};
TimeSchedule.prototype = {
setLesson: function(day, period, lesson) {
if (!this.timeSchedule[day][period-1]) {
this.timeSchedule[day][period-1] = lesson;
}
},
getLesson: function(day, period) {
if (period) {
return this.timeSchedule[day][period-1];
} else {
return this.timeSchedule[day];
}
},
deleteLesson: function(day, period) {
if (this.timeSchedule[day][period-1]) {
this.timeSchedule[day][period-1] = null;
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment