Solution Review: Catch the Error
This lesson will explain the solution to the problem in the previous lesson.
Solution review #
Press + to interact
"use strict";var person = {name: "Nishant"};Object.freeze(person);Object.seal(person);function func(){try{person.name = "xyz"console.log(person.name);}catch(e){console.log("Cannot change name")}try{person.age = 30;console.log(person.age);}catch(e){console.log("Cannot add property age")}try{delete person.nameconsole.log(person.name);}catch(e){console.log("Cannot delete person")}}func()
Explanation #
Your task was to modify the original code (given below) so that none of the operations, modification, addition, or ...
Access this course and 1400+ top-rated courses and projects.