28. passing objects


Hi All,
Can anyone explain why this code doesn't work. thanks in advance.

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;

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

// get the difference in age between alice and billy using our function
var diff = ageDifference(alice, billy){


var diff = ageDifference(alice, billy)

that should be sufficient, why do you add a pseudo function thing after it? Also where does the }; at the very bottom belong to?


Hi and thanks.
I took out the extra bracket and I used the console.log as I wanted to see the age difference.