Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              // creating an object
var anObject = {
  name: "this is an object",
  "object number": 2,
  more_strings: 3,
  "object array": ["one", "two"]
// is this an object?
console.log("anObject is a " + typeof anObject);
console.log("anObject length " + anObject.length); // objects dont have length

var anArray = [["i am an array"], ["i am an array"]];
console.log("anArray is a " + typeof anArray);
// this will also show that this is an object

console.log("anArray length " + anArray.length); // arrays do have length but are also type of object

// accessing the object values
var object_name =;

var object_number = anObject["object number"]; // to access the object with the string as a name you need to use the brackets similar to an array.

// access it via a dynamic variable name
var obj_var_name = "more_strings";
var more_strings_val = anObject[obj_var_name];
console.log("more_strings_val: " + more_strings_val);

// update objects
anObject["object number"] = 6; // you can use brackets and quotes or = "this is still an object"; // use the . if their is no spaces.

// add new object property
anObject["new property"] = "new property value"; // or
anObject.new_property = "another value";

// delete an object property
delete anObject["new property"];
delete anObject.new_property;

// check if a property exists

// function to check if a property exists
function checkObjExists(checkProp) {
  // Your Code Here
  if (anObject.hasOwnProperty(checkProp)) {
    return anObject[checkProp];
  } else {
    return "Not Found";

// complex objects -- create the main structure then add multiple with a comma
var aComplexObject = {
  "object title": {
    "nested one": {
      val1: "value",
      val2: "value 2"
    "nested two": {
      val1: "value two!",
      val2: "value 2"

// see if we can access to read and then update it. you can use a mixture of . and "" to access the properties.
console.log(aComplexObject["object title"]["nested two"].val1);
aComplexObject["object title"]["nested two"].val1 = "value two!!!";
console.log(aComplexObject["object title"]["nested two"].val1);

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.