29/33 What's wrong?


#1

My code isn't working! the message is "TypeError: person2 is undefined"

function Person (name, age) {
    this.name = name;
    this.age = age;
}
var ageDifference = function(person1, person2) {
    return person1.age - person2.age;
};
var olderAge = function(person1,person2) {
    if (person1.age > person2.age) {
        return person1.age
    } else {
        return person2.age
    };
};
var alice = new Person("Alice", 30);
var billy = new Person("Billy", 25);

console.log("A idade da pessoa mais velha é " + olderAge(alice, billy))

PS:
Yes, I'm Br =p


#2

Unable to reproduce the error. This code passes on paste in and submit.


#3

@microace11828,
Maybe you should do a refresh Browser

++++ reset of session *****************
As you are manipulating with objects
under certain circumstances you can shoot your Browser in an
inconsistent state.

Therefor it is of an advantage to know that you have 2 reset facilities:

One is the use of the F5-key which does a refresh Browser

and

Two, select&copy your code
Then use the Reset Code button of the course-window,
then paste your code back in.

Addendum
General Notes:
Always refresh the browser after making corrections:
CTRL f5 ( if on Windows or Linux)
CMD r ( if on a MAC).
CTRL 0 to reset browser zoom


#4

Thank you guys, I tryed it in another browser, the same code worked.
\o/