Consider the Person() constructor used to create the tom object. We copy the tom object to a new variable called newTom. Consequently, newTom is also a object, same as tom.
Functions can return objects. We have seen a bunch of tutorials on functions before. Here, we will see some expected and some unexpected behavior when function returns objects especially when that function is used as a constructor function
The instanceof operator can be used to check weather a object belongs to a particular constructor function or not. We have already discussed creation of objects from constructor functions.
This lesson is continuation of the previous post on constructor functions. We ended the last lesson by asking a question. What if the new keyword is not used ?