...
/Solution Review: Check Instance of Variables
Solution Review: Check Instance of Variables
This lesson will explain the solution to the problem in the previous lesson.
We'll cover the following...
We'll cover the following...
Solution #
Explanation #
This question is tricky as it tests your understanding of functions, constructor functions, and the instanceof operator.
Let’s start by understanding the original code first.
The code has a function, tempFunc1, which has an empty body. The check function creates two variables, object1 and object, both storing different outputs from tempFunc1. How come?
On line 5, we call tempFunc1 as a constructor function by calling it with the ...