Example 1: Depicts implementation of Object.seal().
Example-1 depicts how Object.seal() is used to create a non-extensible object, but that does not prevent the value of the object to be changed and it is seen that the value gets updated to 20.
Example 2: Depicts implementation of Object.freeze().
Example-2 depicts how Object.freeze() is used to create a non-extensible object, but where the existing value of the object is prevented from being changed and 10 is given as the output.
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.