The Object.preventExtensions() static method prevents new properties from ever being added to an object (i.e. prevents future extensions to the object). It also prevents the object’s prototype from being re-assigned.
// Example picked from MDN docsconst object1 = {};Object.preventExtensions(object1);try { Object.defineProperty(object1, 'property1', { value: 42, });} catch (e) { console.log(e); // Expected output: // TypeError: Cannot define property property1, object is not extensible}
There must be a good reason why extensions are not allowed to be added. I followed along the function in which this is used, FiberNode function
calls Object.preventExtension on this, but which function calls FiberNode?
Hey, my name is Ramu Narasinga. I study large open-source projects and create content about their codebase architecture and best practices, sharing it through articles, videos.