Don't understand the use of employee


#1

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?
#2

@hellopopit

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:


#3

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.


#4

This would be the last lesson where applyStaffDiscount is implemented.

https://www.codecademy.com/en/courses/close-the-super-makert/0/7?curriculum_id=506324b3a7dffd00020bf661


#5

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


#6

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