6/7 Doesn't work


#1

// create a constructor for the StaffMember class
function StaffMember(name, discountPercent) {
this.name = name;
this.discountPersent = discountPercent;
}

var sally = new StaffMember("Sally",5);
var bob = new StaffMember("Bob",10);

//Create a StaffMember for yourself called me
var me = new StaffMember("Den", 20);
What's wrong?


#2

You misspelled discountPercent before the equals. Otherwise all is good.


#3

Can someone help me?

My Code:

// create a constructor for the StaffMember class
function StaffMembers(name, discountPercent) {
this.name = name;
this.discountPercent = discountPercent;
};

var sally = new StaffMember("Sally",5);
var bob = new StaffMember("Bob",10);

//Create a StaffMember for yourself called me
var me = new StaffMember("Raphael", 20);

Result: "ReferenceError: StaffMember is not defined" but it passes, weird?


#4

You wrote StaffMember**s** instead of StaffMember for the class name. Here's what worked for me:

function StaffMember (name, discountPercent)
{
     this.name = name,
     this.discountPercent = discountPercent;
};

#5

You have defined staffMembers but then you are using staffMember.

here is my working code..
// create a constructor for the StaffMember class
StaffMember = function(name,discountPercent){
this.name=name;
this.discountPercent=discountPercent;
};

var sally = new StaffMember("Sally",5);
var bob = new StaffMember("Bob",10);

//Create a StaffMember for yourself called me
var me = new StaffMember("Kira",20);