Last active
August 29, 2015 14:22
-
-
Save benevolent0505/e5db5f46dfa57f5ee7cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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