This work for me , if u would like to try it :)


#1

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.age > person2.age){
return person1.age;
}
else if (person1.age ===person2.age){
return (person1.age,person2.age)
}
else {
return person2.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));


#2

So when you have a look at what the comma operator does:
https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Operators/Comma_Operator
You'll see that:

(person1.age,person2.age)

is actually just

person2.age

#3

so we should return it as
return (person1 && person2)?
or
return (person1; person2)?


#4

just return person1.age or return person2.age as this is the case where it checks if the age is equal it doesn't matter. That's also why your initial attempt is correct just with redundant code in it.