Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <h1>Object.freeze() Demo</h1>

<fieldset>
  <legend>Initial Value</legend>
	<label for="firstName1">First Name: </label><input type="text" id="firstName1">
	<br />
	<label for="lastName1">Last Name: </label><input type="text" id="lastName1">
</fieldset>

<fieldset>
  <legend>After Changing First Name</legend>
	<label for="firstName2">First Name: </label><input type="text" id="firstName2">
	<br />
	<label for="lastName2">Last Name: </label><input type="text" id="lastName2">
</fieldset>

<fieldset>
  <legend>After Adding Middle Name</legend>
	<label for="firstName3">First Name: </label><input type="text" id="firstName3">
	<br />
	<label for="middleName3">Middle Name: </label><input type="text" id="middleName3">
	<br />
	<label for="lastName3">Last Name: </label><input type="text" id="lastName3">
</fieldset>

<fieldset>
  <legend>After Deleting Last Name</legend>
	<label for="firstName4">First Name: </label><input type="text" id="firstName4">
	<br />
	<label for="middleName4">Middle Name: </label><input type="text" id="middleName4">
	<br />
	<label for="lastName4">Last Name: </label><input type="text" id="lastName4">
</fieldset>

<fieldset>
  <legend>Is the object frozen?</legend>
	<label for="before">Before the freeze(): </label><input type="text" id="before">
	<br />
	<label for="after">After the freeze(): </label><input type="text" id="after">
</fieldset>
              
            
!

CSS

              
                
              
            
!

JS

              
                // Create the person
const person = {
  firstName: 'Joe',
	lastName: 'Steinbring'
};

document.getElementById('firstName1').value = person.firstName;
document.getElementById('lastName1').value = person.lastName;

// Is it frozen?
document.getElementById('before').value = Object.isFrozen(person);

// Freeze the object
Object.freeze(person);

// Is it frozen?
document.getElementById('after').value = Object.isFrozen(person);

// Change the first name
person.firstName = "John";

document.getElementById('firstName2').value = person.firstName;
document.getElementById('lastName2').value = person.lastName;

// Add a middle name
person.middleName = 'Danger';

document.getElementById('firstName3').value = person.firstName;
document.getElementById('middleName3').value = person.middleName;
document.getElementById('lastName3').value = person.lastName;

// Delete the last name
delete person.lastName;

document.getElementById('firstName4').value = person.firstName;
document.getElementById('middleName4').value = person.middleName;
document.getElementById('lastName4').value = person.lastName;
              
            
!
999px

Console