Tip:
Highlight text to annotate it
X
Remote is a clear preference for blue, number four,
not unanimous but nearly so. Let's go through them. Why can we
rule out the first two immediately? The reason we can rule out
the first two immediately is because we could see that what's
happening. We're trying to call this area function. The area
function tries to make reference to this. Clearly, because we
didn't use the new keyword to construct the square, we're not
going to end up with a real object. We're going to end up with
an undefined object. We're going to have the problem that we
illustrated just a couple of minutes ago on the last slide. We
certainly know that given the way the area function is written
we need be calling square with some variant of� having the new
keyword.� The third answer is a near- miss and it's not correct.
Did people figure out why it's a near- miss? It's almost correct
because area needs parens. A follow on question is I can say "
does that mean that this expression, the third choice, is
illegal?" It's illegal expression, right? It's value is the
actual function object represented by the area property of a�
newly created square type object thing, it's� technical
terminology I'm� using there. The last one was designed to throw
you for a little bit of a loop but it's indeed the correct
answer, right? Var P = square. Functions are first class
objects, right? We can assign them to other things so we're just
assigning to " P" the same function object that square was
defined as being up here, and because it's just another
reference to the same function, we can call it with new, and
then we can call its area method� with a proper parens. The
fourth answer is the correct one and good job for converging on
it. If you're watching online, good job in the event that you
converged on it.�