Challenge: Catch the Error
Understand how to enforce immutability on JavaScript objects by catching errors when code attempts unauthorized modifications. This lesson helps you practice preventing changes to object properties such as additions, deletions, and updates, strengthening your grasp of JavaScript security and error handling.
We'll cover the following...
We'll cover the following...
Problem statement #
In this challenge, you are given an object, person. The function, func, is doing the following:
-
modifying the
nameproperty of theperson -
adding the
ageproperty to theperson...