6/7 Over the Moon


#1



I keep receiving "SyntaxError: Expected ';'" and I can not figure out where it would be looking for a ';' at.


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


#2

When declaring an Object in JavaScript, you use the keyword function not var. So, in your case, the correct code will be

function Staffmember {
/*YOUR CODE*/
}

And me, bob and sally will stay the same.

Regards,
Barry Allen


#3

agh thank you, so simple yet I must have skipped it over 10 times. cheers.


#4

No worries...

Regards,
Barry Allen


#5

this.name=name,
this.discountPercent=discountPercent,
Also, these lines should end with a semicolon not colon...try that.


#6

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