29/33 logs correct answer, and I still cant pass


#1

// Our person constructor
function Person (name, age) {
this.name = name;
this.age = age;
}

// We can make a function which takes persons as arguments
// This one computes the difference in ages between two people
var ageDifference = function(person1, person2) {
return person1.age - person2.age;
};

// Make a new function, olderAge, to return the age of
// the older of two people
var olderAge = function(person1, person2) {
if(person1>person2){
return person2.age;
}else{
return person1.age;
}
};

// Let's bring back alice and billy to test our new function
var alice = new Person("Alice", 30);
var billy = new Person("Billy", 25);

console.log("The older person is " + olderAge(alice, billy));

What is going wrong here. If the code works, it does what it is supposed to do, it logs "The older person is 30."
Why can't I pass? I feel like I am really wasting my time worrying about this.


#2

In your olderAge-function
your IF-condition
should be changed from
(person1>person2)
into
(person1.age>person2.age)


#3

Thanks for that!!!!!