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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

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.

HTML

            
              <p><b>Be sure to open to console to view the results.</b></p>
<br />
<br />
<hr />
<p style="text-align:left;">If you find this demo useful, please consider <a href="https://www.paypal.me/RobertGravelle/1" target="_blank">donating $1 dollar</a> (secure PayPal link) for a coffee or purchasing one of my songs from <a href="https://ax.itunes.apple.com/WebObjects/MZSearch.woa/wa/search?term=rob%20gravelle" target="_blank">iTunes.com</a> or <a href="http://www.amazon.com/s/ref=ntt_srch_drd_B001ES9TTK?ie=UTF8&field-keywords=Rob%20Gravelle&index=digital-music&search-type=ss" target="_blank">Amazon.com</a> for only 0.99 cents each.</p>
<p style="text-align:left;">Rob uses and recommends <a href="http://www.mochahost.com/2425.html" target="_blank">MochaHost</a>, which provides Web Hosting for as low as $1.95 per month, as well as unlimited emails and disk space!</p>
            
          
!

CSS

            
              
            
          
!

JS

            
              "use strict";

function DuckTypeError() {
    var temp = TypeError.apply(this, arguments);
    temp.name = this.name = 'DuckTypeError';
    this.message = temp.message;
    if(Object.defineProperty) {
        // getter for better optimization
        /*this.stack = */Object.defineProperty(this, 'stack', { 
            get: function() {
                return temp.stack
            },
            configurable: true // so you can change it if you want
        })
    } else {
        this.stack = temp.stack
    }
}
//inherit prototype using ECMAScript 5 (IE 9+)
DuckTypeError.prototype = Object.create(TypeError.prototype, {
    constructor: {
        value: DuckTypeError,
        writable: true,
        configurable: true
    }
});

function Infiniti(model) { 
    this.model = model;
}
Infiniti.prototype.accelerate = function() {
    console.log(this.model + ": Going from 0 to 60mph really fast!");
}

function Honda(model) {
    this.model = model;
}
Honda.prototype.accelerate = function() {
    console.log(this.model + ": Going from 0 to 60mph at a moderate speed.");
}

function Hyundai(model) {
    this.model = model;
}
Hyundai.prototype.accelerate = function() {
    console.log(this.model + ": Going from 0 to 60mph at a crawl.");
}

function Couch(type) {
    this.type = type;
}

function race(car) {
    //Dynamically invoke accelerate() method 
    //of whatever car was passed in.
    if (car.accelerate) 
      car.accelerate();  
    else
      throw new DuckTypeError("Hey, you're not a car!");
}

//Let's race some cars!
var cars = [
  new Infiniti("G37"),
  new Honda("Civic"),
  new Hyundai("Accent")
];
for (var i in cars) { 
  race(cars[i]);
}

//try to race a sofa!?
race( new Couch("Sofa") ); 

            
          
!
999px

Console