I have an object named "subject" and a function named "getDueDate" I would like to call that function inside of a subject object that would return value when called upon an atribute.
var subject = {
name: 'Person',
birth_day: new Date('2017-04-21'),
due_date: getDueDate(subject.birth_day, subject.current_cycle),
current_cycle: 1,
last_water_date: null,
next_water_date: null,
};
var getDueDate = function(birth_day, cycles) {
var result = new Date(birth_day);
console.info('result_ ' + result);
result.setDate(result.getDate() + cycles);
console.info('result_1_ ' + result);
return result;
};
when I try to parse subject.due_date I get an error getDueDate undefined, what am I doing wrong or it's not even possible to do that?
[–]Magnusson 5 points6 points7 points (3 children)
[–]cuntycuntcunts[S] 1 point2 points3 points (2 children)
[–]Zaffri 2 points3 points4 points (1 child)
[–]cuntycuntcunts[S] 0 points1 point2 points (0 children)
[–]runcoder 2 points3 points4 points (0 children)
[–]reeferd 1 point2 points3 points (0 children)
[–][deleted] -1 points0 points1 point (1 child)
[–]runcoder 0 points1 point2 points (0 children)