Prototype-based Inheritance in JavaScript with Constructors using Object.create()

const obj1 = { property1: 'freeze'}; // Creates an object named obj1 with property1 set to 'freeze' const obj2 = Object.freeze(obj1); // Freezes obj1 and assigns it to obj2 obj2.property1 = 'new_data'; // Attempting to modify property1 of obj2 (which is frozen) - this line won't throw an error but the modification won't occur console.log(obj2.property1); // Logs the value of property1 of obj2 to the console (it remains 'freeze')

Output: