29/33 please help


#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
{
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);
var diff = ageDifference(Alice, Billy);
console.log(diff);


#2

hello mr_cheese_47,
I see you've got a few errors in your code, as well in the olderAge function as in the age difference function. I suggest you try to fix them and read the instructions again (I must admit they are pretty vague).


If you can't figure it out, check the following:
- check if you have parentheses {} after every function declaration or have a semicolon; between the brackets and the parentheses.
- you should change the = in var ageDifference to a - or otherwise it won't substract the age of the persons.
- another parenthese mistake: after declaring your function person you forgot a }.
- you declare the function Person at the begining, but at the end you forget to capitalize it.
- if you have a string as an argument (the thing between brackets) you should make it a "string" by adding "" around the string

I hope you can solve it now
and good luck with any further coding

Ps: I really like your name :grin:


#3

thank you very much it helped me and your name is cool also