Help stuck 29


keeps saying
Oops, try again. There was a problem with your syntax.
please help

// Our person constructor
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> person2) {
         return person1.age;
        }    else {
        return person2.age;


Double bracket in IF condition in olderAge function ?


Which one.Which Bracket


if**(**(person1> person2) { <- one of it is unnessesary


thanks mate I didnt notice it


No problem :wink: keep coding :wink:



But now i have a different problem keeps saying
It looks like your olderAge function fails when the first Person is older! It should return the age of the older person


Look what you are comparating.
if (person1 > person2)

You are comparating whole object not their age :slight_smile: Try this one:
if (person1.age > person2.age)


Thanks alot it worked


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