Search⌘ K
AI Features

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.

Problem statement #

In this challenge, you are given an object, person. The function, func, is doing the following:

  1. modifying the name property of the person

  2. adding the age property to the person ...