Why is this code not working? Oops, try again. It looks like the value of diff is not a number! Make sure you are setting it equal to ageDifference(alice,billy). The Debugger says:" Make sure not to put quotes around alice and billy!"


#1

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

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 = console.log("The age difference between Allice and Billy is", ageDifference(alice, billy));


#2

@codemasterchief,
Try it by removing your string "The age difference between Allice and Billy is"
from your console.log() statement....

Like the instruction asks
We have created two example people, alice and billy.
Complete line 17 by calling ageDifference and saving the result in our global diff variable.