The preventExtensions() Method in JavaScript
In JavaScript, the preventExtensions() method is used with the Object object. This method takes an object as an argument and returns the same object. The preventExtensions() method modifies the object, making it unable to accept new properties. However, it still allows for the removal and modification of existing properties. Here is an example: const dog = {} dog.breed = 'Siberian Husky' Object.preventExtensions(dog) dog.name = 'Roger' // TypeError: Cannot add property name, object is not extensible In this example, we create a new object called dog and assign the property breed with the value 'Siberian Husky'....