Print the age of the older person


Error: Oops, try again. Your olderAge function seems to be returning something other than a number. The function should return the AGE of the older person

function Person (name, age) { = name;
this.age = age;

var ageDifference = function(person1, person2) {
return person1.age - person2.age;

var olderAge = function (alice,billy) {
if (alice.age > billy.age) {
} else {

var alice = new Person("Alice", 30);
var billy = new Person("Billy", 25);

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


These need to be person1 and person2, as well as

right here.


Thank you kyleaw.
I wrote console.log instead of return, that was my :slight_smile:


Whoops, I didn't even notice that. :slight_smile:


Do you know what is difference between console.log and return?


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.