29/33 Please help me figure out why it's wrong!


#1

First off I hope this doesn't get deleted. Secondly WHY every time I get a syntax error. How long does it take to learn the intricacies of the syntax. Here's my code. Please help me figure out who it's wrong!

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

// 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

Hi, there are many mistakes. Firstly


#3

Second error is at this line.

Please write again if any problem occurs .


#4

Another problem I see is that you never put a conditional after an 'else' statement. The 'else' should cover everything else after all the ifs and else ifs are done. Think about it this way: if the age of one is not greater or equal to the other than the only thing left (the 'else' part) is the age is less than the other.