Search⌘ K
AI Features

Exercise 2: Proxy

Explore how to implement a JavaScript proxy that intercepts method calls beginning with play, returning custom messages based on activity presence. Understand dynamic object behavior modification through proxies, including error handling for unsupported methods in this practical exercise.

We'll cover the following...

Problem statement

Create a proxy that will receive a method that starts with play and returns the string message “I love to play …” message if the part after play is contained in an activities array ...