6. Over the Moon



I could swear my code is correct, yet keep getting the error
"SyntaxError: missing before statement"

// create a constructor for the StaffMember class
var 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("Jessica",20);


Here's the constructor:

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

You have a colon instead of an equals sign there. Though I believe yours is correct, it does want this method. Hope this helps.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.