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


function Person (name, age) { = 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));


So when you have a look at what the comma operator does:
You'll see that:


is actually just



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


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.