Object building functions are functions that are written to create objects. These functions return an object based on the parameters when the function is called. Object building functions are extremely useful as they create reusable code that can be run multiple times for a similar result. Take a look at the example below.
The function in the code sample above creates a new object based on the parameters
last_name. The object consists of three properties, one of which is a function
fullName. The function returns an object when it is called, which is why the variables
chad are now an object. The use of the keyword
new is crucial as it creates a new instance of the function using the given inputs. Printing an object results in a format similar to the object itself, with the property name as well as the property value.