Over the moon - prints undefined


#1

why are does it print out undefined?

// 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("Me", 20);

console.log(StaffMember(bob));


#2

The above is printing the return value of the StaffMember() function. Since there is no return value, JS responds by stepping in with, undefined.

    console.log(bob);

#3

Thanks for responding. I will play around with this.


#4

my code not defined . why?


#5

Hi you forgot to put the argument name and discountPercent to the object staffMember