Context with Call
greet
that logs a greeting message to the console with the name
property of the object it is passed to as an argument.call()
method to execute in the context of the object, so you shouldn't have to change the greet
function declaration.Solution Walkthrough for Context with Call
Spoiler Alert!
Don't read this unless you've already solved the problem.
call()
, we can specify the object that should be used as the context for the function execution. In this case, we pass the person
object as the first argument to call()
, which sets this
inside the greet
function to the person
object.