This doesn't require the use of the function keyword. Behind the scenes, the same thing is happening. Commas aren't required between method definitions, and semicolons are optional.

Currently we only have hardcoded strings in our objects, so let's introduce state and constructor functions.

The Constructor

Managing state consistently requires some initialization logic for an object, that is implemented with a constructor. The constructor function is automatically invoked when you say new <classname>, and inside the constructor you can use the implicit this reference to manipulate the object and store instance state.

Note that the makeEveryoneWork function doesn't care if someone is a person or an employee, because both have a doWork method. To adjust to code to have a check that the object passed in has a doWork function, use: