Im creating an object and pushing to an array this.reminders , but an undefined is also gets push why is that? This code will give me work [ { description: 'Get to work in time', set_title: 'work related' }, undefined ]
var ReminderSet = function(set_name) {
this.set_name = set_name;
this.reminders = [];
};
ReminderSet.prototype.add = function(reminder, title) {
this.reminders.push(reminder, title);
console.log(this.set_name, this.reminders)
};
ReminderSet.prototype.list = function() {
console.log(this.reminders);
};
var Reminder = function(description,set_title) {
this.description = description;
this.set_title = set_title;
//Describes the reminder
};
var work = new ReminderSet("work")
.add(new Reminder("Get to work in time", "work related"));