Don't understand the use of employee


I don't understand the use of employee, because employee was never defined and shouldn't we have just used an object in the function that kept track of all the names.

7/7 Can someone help?


Do you think you could link your code and precisely what lesson you're on? This will help us help you in an efficient manner :smiley:


StaffMember and cashRegister are two separate objects. The staff member object is not a part of cashRegister, but a separate instance of the StaffMember constructor.

When we pass me to the applyStaffDiscount method, the local variable employee references that object.

As far as keeping a list, we would need to store each instance in an array or object, both of which are iterable. Something to think about if you wish to continue this project.


This would be the last lesson where applyStaffDiscount is implemented.


Thank you, I looked for a little bit but ran into some trouble, I appreciate it!


3 posts were split to a new topic: Extra study: Build a Cash Register